@edu-tosel/design 1.0.68 → 1.0.70
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/card/design/TableCard.design.d.ts +1 -1
- package/card/design/TableCard.design.js +1 -1
- package/card/template/TableCard.d.ts +2 -2
- package/interface/Action.d.ts +7 -4
- package/interface/Card.d.ts +2 -2
- package/interface/Data.d.ts +15 -4
- package/interface/Data.js +4 -1
- package/layout/design/Row.design/SelectRoll.d.ts +6 -4
- package/layout/design/Row.design/SelectRoll.js +17 -5
- package/layout/design/Row.design/index.d.ts +1 -1
- package/layout/design/Row.design/index.js +11 -7
- package/layout/template/Row.d.ts +3 -3
- package/layout/template/Row.js +2 -2
- package/package.json +1 -1
- package/version.txt +1 -1
- package/widget/design/Label.design.js +4 -2
- package/widget/template/Pagination.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TableCardProps } from "../../interface";
|
|
2
|
-
export default function TableCardDesign<T>({ dataSet, dataField, option, }: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function TableCardDesign<T, S>({ dataSet, dataField, option, }: TableCardProps<T, S>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,7 +21,7 @@ export default function TableCardDesign({ dataSet, dataField, option, }) {
|
|
|
21
21
|
height: height ?? "3xl",
|
|
22
22
|
overflow: "overflow-y-scroll overflow-x-hidden",
|
|
23
23
|
noPadding: true,
|
|
24
|
-
}, children: _jsxs(Action.Replace, { actions: dataSet?.replaces, children: [sortByOrder({ items: dataSet?.items, orders }).map((item, index) => dataSet.renderItem ? (dataSet.renderItem(item)) : (_jsx(Row.Card, { item: item, onClick: () => dataSet.onClick?.(item), dataField: dataField, height: option?.rowHeight, noHover: option?.noHover, noPadding: option?.noRowPadding }, id + index))), _jsx(Obstacle, { disabled: isDisabled }), _jsx(Obstacle.Blur, { disabled: isDisabled, option: {
|
|
24
|
+
}, children: _jsxs(Action.Replace, { actions: dataSet?.replaces, children: [sortByOrder({ items: dataSet?.items, orders }).map((item, index) => dataSet.renderItem ? (dataSet.renderItem(item)) : (_jsx(Row.Card, { item: item, state: dataSet.state, onClick: () => dataSet.onClick?.(item), dataField: dataField, height: option?.rowHeight, noHover: option?.noHover, noPadding: option?.noRowPadding }, id + index))), _jsx(Obstacle, { disabled: isDisabled }), _jsx(Obstacle.Blur, { disabled: isDisabled, option: {
|
|
25
25
|
position: "top-10",
|
|
26
26
|
}, children: _jsx(Lock, { script: disabledScript }) })] }) }));
|
|
27
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TableCardProps } from "../../interface";
|
|
2
|
-
declare function TableCard<T>(props: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function TableCard<T, S>(props: TableCardProps<T, S>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare namespace TableCard {
|
|
4
|
-
var Log: <T>(props: TableCardProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
var Log: <T, S>(props: TableCardProps<T, S>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
}
|
|
6
6
|
export default TableCard;
|
package/interface/Action.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LabelWidget } from "./widget";
|
|
2
|
-
import { OnClick, Size } from "./Property";
|
|
2
|
+
import { OnClick, Size, State } from "./Property";
|
|
3
3
|
import { DataField, DataFieldType } from "./Data";
|
|
4
4
|
import { Color } from "./Color";
|
|
5
5
|
export interface ActionEvent {
|
|
@@ -29,8 +29,9 @@ export interface DataFieldProps<T> {
|
|
|
29
29
|
padding?: string;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
export interface RowProps<T> {
|
|
32
|
+
export interface RowProps<T, S> {
|
|
33
33
|
item: T;
|
|
34
|
+
state?: State<S[] | undefined>;
|
|
34
35
|
dataField?: DataField<T>;
|
|
35
36
|
onClick?: OnClick<T>;
|
|
36
37
|
buttons?: LabelWidget[];
|
|
@@ -45,8 +46,10 @@ export interface RowProps<T> {
|
|
|
45
46
|
className?: string;
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
|
-
export interface RowElementProps {
|
|
49
|
-
item:
|
|
49
|
+
export interface RowElementProps<T, S> {
|
|
50
|
+
item: T;
|
|
51
|
+
entry: [string, unknown];
|
|
52
|
+
state?: State<S[] | undefined>;
|
|
50
53
|
data?: DataFieldType;
|
|
51
54
|
}
|
|
52
55
|
export {};
|
package/interface/Card.d.ts
CHANGED
|
@@ -116,8 +116,8 @@ export interface AddCardProps extends Omit<CardProps, "children"> {
|
|
|
116
116
|
icon?: string;
|
|
117
117
|
onClick: OnClick;
|
|
118
118
|
}
|
|
119
|
-
export interface TableCardProps<T> extends Omit<CardProps, "children"> {
|
|
120
|
-
dataSet: Flexify<DataSet<T>, "renderItem">;
|
|
119
|
+
export interface TableCardProps<T, S> extends Omit<CardProps, "children"> {
|
|
120
|
+
dataSet: Flexify<DataSet<T, S>, "renderItem">;
|
|
121
121
|
dataField?: DataField<T>;
|
|
122
122
|
option?: CardOption & {
|
|
123
123
|
className?: string;
|
package/interface/Data.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Replace } from "./Action";
|
|
2
|
-
import { OnClick, Titles } from "./Property";
|
|
2
|
+
import { OnClick, State, Titles } from "./Property";
|
|
3
3
|
export interface DataPackage<T> {
|
|
4
4
|
dataField: DataField<T>;
|
|
5
5
|
dataSet: Omit<DataSet<T>, "renderItem">;
|
|
6
6
|
}
|
|
7
|
-
export type DataSet<T = any> = {
|
|
7
|
+
export type DataSet<T = any, S = any> = {
|
|
8
8
|
items?: T[];
|
|
9
|
+
state?: State<S[] | undefined>;
|
|
9
10
|
renderItem: (item: T, index?: number) => React.ReactNode;
|
|
10
11
|
titles?: Titles;
|
|
11
12
|
interaction?: React.ReactNode;
|
|
@@ -20,7 +21,7 @@ type DataFieldProps = {
|
|
|
20
21
|
export type DataField<T = any> = Partial<{
|
|
21
22
|
[p in keyof T]: Partial<DataFieldProps>;
|
|
22
23
|
}>;
|
|
23
|
-
export type DataFieldType = DataFiledTypeText | DataSelectRoll;
|
|
24
|
+
export type DataFieldType = DataFiledTypeText | DataSelectRoll | DataButton;
|
|
24
25
|
type DataFiledTypeText = {
|
|
25
26
|
type: "text";
|
|
26
27
|
};
|
|
@@ -37,5 +38,15 @@ type DataSelectRoll = {
|
|
|
37
38
|
options: SelectRollOption[];
|
|
38
39
|
};
|
|
39
40
|
declare function isDataSelectRoll(obj: any): obj is DataSelectRoll;
|
|
41
|
+
type DataButton = {
|
|
42
|
+
type: "button";
|
|
43
|
+
onClick: OnClick;
|
|
44
|
+
hoverTitle?: string;
|
|
45
|
+
option?: {
|
|
46
|
+
text?: string;
|
|
47
|
+
background?: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
declare function isDataButton(obj: any): obj is DataButton;
|
|
40
51
|
export type { DataFiledTypeText, DataSelectRoll };
|
|
41
|
-
export { isDataSelectRoll };
|
|
52
|
+
export { isDataSelectRoll, isDataButton };
|
package/interface/Data.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
function isDataSelectRoll(obj) {
|
|
2
2
|
return typeof obj === "object" && obj.type === "selectRoll";
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
function isDataButton(obj) {
|
|
5
|
+
return typeof obj === "object" && obj.type === "button";
|
|
6
|
+
}
|
|
7
|
+
export { isDataSelectRoll, isDataButton };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { DataSelectRoll } from "../../../interface";
|
|
2
|
-
interface SelectRollProps {
|
|
3
|
-
item:
|
|
1
|
+
import { DataSelectRoll, State } from "../../../interface";
|
|
2
|
+
interface SelectRollProps<T, S> {
|
|
3
|
+
item: T;
|
|
4
|
+
entry: [string, unknown];
|
|
5
|
+
state: State<S[] | undefined>;
|
|
4
6
|
data: DataSelectRoll;
|
|
5
7
|
}
|
|
6
|
-
export default function SelectRoll({ item, data }: SelectRollProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function SelectRoll<T, S>({ item, entry, state, data, }: SelectRollProps<T, S>): import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
3
|
import { cn } from "../../../util";
|
|
4
|
-
export default function SelectRoll({ item, data }) {
|
|
4
|
+
export default function SelectRoll({ item, entry, state, data, }) {
|
|
5
5
|
const { options } = data ?? {};
|
|
6
|
+
const [key, value] = entry;
|
|
7
|
+
const [rows, setRows] = state ?? [];
|
|
6
8
|
const [isHover, setIsHover] = useState(false);
|
|
7
9
|
const keys = options?.map((option) => option.key);
|
|
8
10
|
const values = options?.map((option) => option.value);
|
|
9
|
-
const [index, setIndex] = useState(keys?.indexOf(String(item)) ?? 0);
|
|
11
|
+
const [index, setIndex] = useState(keys?.indexOf(String(item[key])) ?? 0);
|
|
10
12
|
const container = {
|
|
11
13
|
styles: "group cursor-default",
|
|
12
14
|
displays: "flex justify-center",
|
|
@@ -29,11 +31,21 @@ export default function SelectRoll({ item, data }) {
|
|
|
29
31
|
sizes: "w-[20px] h-full",
|
|
30
32
|
styles: "duration-300 text-gray-dark",
|
|
31
33
|
};
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setRows(rows?.map((row) => {
|
|
36
|
+
if (row === item) {
|
|
37
|
+
return { ...row, [key]: keys[index] };
|
|
38
|
+
}
|
|
39
|
+
return row;
|
|
40
|
+
}));
|
|
41
|
+
}, [index]);
|
|
32
42
|
return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), onMouseLeave: () => setIsHover(false), onMouseEnter: () => setIsHover(true), children: [values[index], _jsx("button", { onClick: () => {
|
|
33
|
-
if (index > 0)
|
|
43
|
+
if (index > 0) {
|
|
34
44
|
setIndex(index - 1);
|
|
45
|
+
}
|
|
35
46
|
}, className: cn(toggle, "-left-4 group-hover:left-1"), children: "-" }), _jsx("button", { onClick: () => {
|
|
36
|
-
if (index < keys.length - 1)
|
|
47
|
+
if (index < keys.length - 1) {
|
|
37
48
|
setIndex(index + 1);
|
|
49
|
+
}
|
|
38
50
|
}, className: cn(toggle, "-right-4 group-hover:right-1"), children: "+" })] }) }));
|
|
39
51
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RowProps } from "../../../interface";
|
|
2
|
-
export default function RowDesign<T>({ item, dataField, option, onClick, buttons, dot, }: RowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function RowDesign<T, S>({ item, state, dataField, option, onClick, buttons, dot, }: RowProps<T, S>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
|
-
import { ColorSet, isDataSelectRoll, } from "../../../interface";
|
|
3
|
+
import { ColorSet, isDataButton, isDataSelectRoll, } from "../../../interface";
|
|
4
4
|
import { cn } from "../../../util";
|
|
5
5
|
import { Label } from "../../../widget";
|
|
6
6
|
import { widthSizes } from "../../../asset/sizes";
|
|
7
7
|
import SelectRoll from "./SelectRoll";
|
|
8
|
-
export default function RowDesign({ item, dataField, option, onClick, buttons, dot, }) {
|
|
8
|
+
export default function RowDesign({ item, state, dataField, option, onClick, buttons, dot, }) {
|
|
9
9
|
const { size, padding, text, noHover, className, isPointer } = option ?? {};
|
|
10
10
|
const id = useId();
|
|
11
11
|
const container = {
|
|
@@ -28,7 +28,7 @@ export default function RowDesign({ item, dataField, option, onClick, buttons, d
|
|
|
28
28
|
styles: "rounded-full",
|
|
29
29
|
};
|
|
30
30
|
return (_jsxs("div", { className: cn(container), onClick: () => onClick?.(), children: [typeof dot !== "undefined" && _jsx("div", { className: cn(flagBox) }), dataField &&
|
|
31
|
-
Object.
|
|
31
|
+
Object.entries(dataField).map(([key, value]) => (_jsx("div", { className: cn(widthSizes[dataField[key]?.size], itemBox), children: _jsx(RowElement, { state: state, entry: [key, value], item: item, data: dataField[key]?.data }) }, id + key))), _jsx("div", { className: "absolute right-4 xl:right-8 flex gap-4", children: buttons?.map(({ title, onClick, option }) => (_jsx(Label.Button, { title: title, onClick: onClick, option: {
|
|
32
32
|
background: option?.background ?? "bg-crimson-dark",
|
|
33
33
|
text: option?.text ?? "text-white",
|
|
34
34
|
width: "xs",
|
|
@@ -36,8 +36,12 @@ export default function RowDesign({ item, dataField, option, onClick, buttons, d
|
|
|
36
36
|
} }, id + title))) })] }));
|
|
37
37
|
}
|
|
38
38
|
function RowElement(props) {
|
|
39
|
-
const { data } = props;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const { item, data } = props;
|
|
40
|
+
const [key, value] = props.entry;
|
|
41
|
+
if (isDataSelectRoll(data) && props.state) {
|
|
42
|
+
return (_jsx(SelectRoll, { item: item, state: props.state, entry: props.entry, data: data }));
|
|
43
|
+
}
|
|
44
|
+
if (isDataButton(data))
|
|
45
|
+
return (_jsx(Label.Button, { title: item[key], hoverTitle: data.hoverTitle, onClick: data.onClick, option: { ...data.option, width: "xs", height: "xs" } }));
|
|
46
|
+
return _jsx(_Fragment, { children: item[key] });
|
|
43
47
|
}
|
package/layout/template/Row.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RowProps } from "../../interface";
|
|
2
|
-
declare function Row<T>({ item, dataField, onClick, buttons, dot }: RowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function Row<T, S>({ item, dataField, onClick, buttons, dot }: RowProps<T, S>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare namespace Row {
|
|
4
|
-
var Card: <T>({ item, dataField, onClick, buttons, height, noPadding, noHover, dot, }: Omit<RowProps<T>, "option"> & {
|
|
4
|
+
var Card: <T, S>({ item, dataField, state, onClick, buttons, height, noPadding, noHover, dot, }: Omit<RowProps<T, S>, "option"> & {
|
|
5
5
|
height?: string | undefined;
|
|
6
6
|
noPadding?: boolean | undefined;
|
|
7
7
|
noHover?: boolean | undefined;
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
var Board: <T>({ item, dataField, onClick, buttons, dot, option, }: RowProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
var Board: <T, S>({ item, dataField, onClick, buttons, dot, option, }: RowProps<T, S>) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
}
|
|
11
11
|
export default Row;
|
package/layout/template/Row.js
CHANGED
|
@@ -18,9 +18,9 @@ function Board({ item, dataField, onClick, buttons, dot, option, }) {
|
|
|
18
18
|
text: "text-xl",
|
|
19
19
|
} }, id));
|
|
20
20
|
}
|
|
21
|
-
function Card({ item, dataField, onClick, buttons, height, noPadding, noHover, dot, }) {
|
|
21
|
+
function Card({ item, dataField, state, onClick, buttons, height, noPadding, noHover, dot, }) {
|
|
22
22
|
const id = useId();
|
|
23
|
-
return (_jsx(RowDesign, { onClick: onClick, item: item, dataField: dataField, buttons: buttons, dot: dot, option: {
|
|
23
|
+
return (_jsx(RowDesign, { onClick: onClick, item: item, state: state, dataField: dataField, buttons: buttons, dot: dot, option: {
|
|
24
24
|
size: `w-full ${height ?? "h-15"}`,
|
|
25
25
|
padding: !noPadding ? "px-2 xs:px-4 xl:px-5" : "",
|
|
26
26
|
text: "text-base",
|
package/package.json
CHANGED
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.70
|
|
@@ -2,13 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from "../../util";
|
|
3
3
|
import { Obstacle } from "../..";
|
|
4
4
|
const widthSize = {
|
|
5
|
-
|
|
5
|
+
"2xs": "w-10",
|
|
6
|
+
xs: "w-20",
|
|
6
7
|
sm: "w-22.5",
|
|
7
8
|
md: "w-45",
|
|
8
9
|
lg: "w-50",
|
|
9
10
|
};
|
|
10
11
|
const heightSize = {
|
|
11
|
-
|
|
12
|
+
"2xs": "h-6.25",
|
|
13
|
+
xs: "h-7.5",
|
|
12
14
|
sm: "h-11.25",
|
|
13
15
|
md: "h-12.25",
|
|
14
16
|
};
|
|
@@ -12,7 +12,7 @@ export default function Pagination({ state, selectOptions, }) {
|
|
|
12
12
|
};
|
|
13
13
|
const index = selectOptions.indexOf(value);
|
|
14
14
|
return (_jsxs("div", { className: cn(container), children: [_jsx(SVG.Symbol.LessThan, { onClick: () => {
|
|
15
|
-
if (index >
|
|
15
|
+
if (index > 0)
|
|
16
16
|
setValue(selectOptions[index - 1]);
|
|
17
17
|
} }), _jsxs("div", { className: "flex items-center gap-x-[3px] text-white", children: [index + 1, _jsx("div", { className: "text-gray-medium text-base font-pretendard-bold", children: "/" }), selectOptions.length] }), _jsx(SVG.Symbol.GreaterThan, { onClick: () => {
|
|
18
18
|
if (index < selectOptions.length - 1)
|