@edu-tosel/design 1.0.79 → 1.0.80
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.js +7 -1
- package/interface/Action.d.ts +1 -1
- package/interface/Data.d.ts +7 -7
- package/layout/design/DataField.design.d.ts +1 -1
- package/layout/design/DataField.design.js +2 -1
- package/layout/design/Row.design/index.js +1 -1
- package/layout/template/DataField.d.ts +1 -1
- package/layout/template/DataField.js +1 -1
- package/layout/template/Row.d.ts +2 -2
- package/layout/template/Row.js +3 -2
- package/package.json +2 -1
- package/version.txt +1 -1
|
@@ -5,6 +5,7 @@ import { cn, sortByOrder } from "../../util";
|
|
|
5
5
|
import Card from "./Card.design";
|
|
6
6
|
import { DataField, Action, Row, Lock } from "../..";
|
|
7
7
|
import { Obstacle } from "../..";
|
|
8
|
+
import { v4 } from "uuid";
|
|
8
9
|
export default function TableCardDesign({ dataSet, dataField, option, }) {
|
|
9
10
|
const { width, height, padding, boundary, isDisabled, disabledScript } = option ?? {};
|
|
10
11
|
const { order } = useActionStore();
|
|
@@ -21,7 +22,12 @@ export default function TableCardDesign({ dataSet, dataField, option, }) {
|
|
|
21
22
|
height: height ?? "3xl",
|
|
22
23
|
overflow: "overflow-y-scroll overflow-x-hidden",
|
|
23
24
|
noPadding: true,
|
|
24
|
-
}, children: _jsxs(Action.Replace, { actions: dataSet?.replaces, children: [sortByOrder({ items: dataSet?.items, orders }).map((item
|
|
25
|
+
}, children: _jsxs(Action.Replace, { actions: dataSet?.replaces, children: [sortByOrder({ items: dataSet?.items, orders }).map((item) => {
|
|
26
|
+
const uuid = v4();
|
|
27
|
+
if (dataSet.renderItem)
|
|
28
|
+
return dataSet.renderItem(item);
|
|
29
|
+
return (_jsx(Row.Card, { item: item, onClick: () => dataSet.onClick?.(item), dataField: dataField, height: option?.rowHeight, noHover: option?.noHover, noPadding: option?.noRowPadding }, uuid));
|
|
30
|
+
}), _jsx(Obstacle, { disabled: isDisabled }), _jsx(Obstacle.Blur, { disabled: isDisabled, option: {
|
|
25
31
|
position: "top-10",
|
|
26
32
|
}, children: _jsx(Lock, { script: disabledScript }) })] }) }));
|
|
27
33
|
}
|
package/interface/Action.d.ts
CHANGED
package/interface/Data.d.ts
CHANGED
|
@@ -12,15 +12,15 @@ export type DataSet<T = any> = {
|
|
|
12
12
|
onClick?: OnClick<T>;
|
|
13
13
|
replaces?: Replace[];
|
|
14
14
|
};
|
|
15
|
-
type DataFieldProps = {
|
|
15
|
+
type DataFieldProps<T> = {
|
|
16
16
|
title: string | number;
|
|
17
17
|
size: string | number;
|
|
18
|
-
data?: DataFieldType
|
|
18
|
+
data?: DataFieldType<T>;
|
|
19
19
|
};
|
|
20
20
|
export type DataField<T = any> = Partial<{
|
|
21
|
-
[p in keyof T]: Partial<DataFieldProps
|
|
21
|
+
[p in keyof T]: Partial<DataFieldProps<T>>;
|
|
22
22
|
}>;
|
|
23
|
-
export type DataFieldType = DataFiledTypeText | DataSelectRoll | DataButton
|
|
23
|
+
export type DataFieldType<T> = DataFiledTypeText | DataSelectRoll | DataButton<T>;
|
|
24
24
|
type DataFiledTypeText = {
|
|
25
25
|
type: "text";
|
|
26
26
|
};
|
|
@@ -37,15 +37,15 @@ type DataSelectRoll = {
|
|
|
37
37
|
options: SelectRollOption[];
|
|
38
38
|
};
|
|
39
39
|
declare function isDataSelectRoll(obj: any): obj is DataSelectRoll;
|
|
40
|
-
type DataButton = {
|
|
40
|
+
type DataButton<T> = {
|
|
41
41
|
type: "button";
|
|
42
|
-
onClick: OnClick
|
|
42
|
+
onClick: OnClick<T>;
|
|
43
43
|
hoverTitle?: string;
|
|
44
44
|
option?: {
|
|
45
45
|
text?: string;
|
|
46
46
|
background?: string;
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
declare function isDataButton(obj: any): obj is DataButton
|
|
49
|
+
declare function isDataButton<T>(obj: any): obj is DataButton<T>;
|
|
50
50
|
export type { DataFiledTypeText, DataSelectRoll };
|
|
51
51
|
export { isDataSelectRoll, isDataButton };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DataFieldProps } from "../../interface";
|
|
2
|
-
export default function DataFieldDesign<T
|
|
2
|
+
export default function DataFieldDesign<T = any>({ id, dataField, option, }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -23,7 +23,8 @@ export default function DataFieldDesign({ id, dataField, option, }) {
|
|
|
23
23
|
sizes: container.sizes,
|
|
24
24
|
};
|
|
25
25
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container), children: dataField &&
|
|
26
|
-
Object.keys(dataField).map((key) => (_jsx("div", { className: widthSizes[dataField[key]
|
|
26
|
+
Object.keys(dataField).map((key) => (_jsx("div", { className: widthSizes[dataField[key]
|
|
27
|
+
?.size], children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center", children: [_jsx("div", { children: dataField[key]?.title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
|
|
27
28
|
if (orderBy === key) {
|
|
28
29
|
if (orderHow === "asc")
|
|
29
30
|
return _jsx(SVG.Direction.Asc, {});
|
|
@@ -45,6 +45,6 @@ function RowElement(props) {
|
|
|
45
45
|
return _jsx(SelectRoll, { item: item, entry: props.entry, data: data });
|
|
46
46
|
}
|
|
47
47
|
if (isDataButton(data))
|
|
48
|
-
return (_jsx(Label.Button, { title: item[key], hoverTitle: data.hoverTitle, onClick: data.onClick, option: { ...data.option, width: "xs", height: "xs" } }));
|
|
48
|
+
return (_jsx(Label.Button, { title: item[key], hoverTitle: data.hoverTitle, onClick: () => data.onClick(item), option: { ...data.option, width: "xs", height: "xs" } }));
|
|
49
49
|
return _jsx(_Fragment, { children: item[key] });
|
|
50
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataFieldProps } from "../../interface";
|
|
2
|
-
declare function Board<T
|
|
2
|
+
declare function Board<T extends Record<string, any>>({ id, dataField, }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare function Card<T>({ id, dataField }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const DataField: {
|
|
5
5
|
Board: typeof Board;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import DataFieldDesign from "../design/DataField.design";
|
|
3
|
-
function Board({ id, dataField }) {
|
|
3
|
+
function Board({ id, dataField, }) {
|
|
4
4
|
return (_jsx(DataFieldDesign, { id: id, dataField: dataField, option: {
|
|
5
5
|
position: "fixed top-34 xl:top-0 left-0 xl:relative z-20",
|
|
6
6
|
padding: "px-2 xs:px-4 xl:px-7.5",
|
package/layout/template/Row.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RowProps } from "../../interface";
|
|
2
2
|
declare function Row<T>({ item, dataField, onClick, buttons, dot }: RowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare namespace Row {
|
|
4
|
-
var
|
|
4
|
+
var Board: <T>({ item, dataField, onClick, buttons, dot, option, }: RowProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
var Card: <T>({ item, dataField, stateAction, onClick, buttons, height, noPadding, noHover, dot, option, }: RowProps<T> & {
|
|
5
6
|
height?: string | undefined;
|
|
6
7
|
noPadding?: boolean | undefined;
|
|
7
8
|
noHover?: boolean | undefined;
|
|
8
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
var Board: <T>({ item, dataField, onClick, buttons, dot, option, }: RowProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
}
|
|
11
11
|
export default Row;
|
package/layout/template/Row.js
CHANGED
|
@@ -18,15 +18,16 @@ function Board({ item, dataField, onClick, buttons, dot, option, }) {
|
|
|
18
18
|
text: "text-xl",
|
|
19
19
|
} }, id));
|
|
20
20
|
}
|
|
21
|
-
function Card({ item, dataField, stateAction, onClick, buttons, height, noPadding, noHover, dot, }) {
|
|
21
|
+
function Card({ item, dataField, stateAction, onClick, buttons, height, noPadding, noHover, dot, option, }) {
|
|
22
22
|
const id = useId();
|
|
23
23
|
return (_jsx(RowDesign, { onClick: onClick, item: item, stateAction: stateAction, dataField: dataField, buttons: buttons, dot: dot, option: {
|
|
24
|
+
...option,
|
|
24
25
|
size: `w-full ${height ?? "h-15"}`,
|
|
25
26
|
padding: !noPadding ? "px-2 xs:px-4 xl:px-5" : "",
|
|
26
27
|
text: "text-base",
|
|
27
28
|
noHover,
|
|
28
29
|
} }, id));
|
|
29
30
|
}
|
|
30
|
-
Row.Card = Card;
|
|
31
31
|
Row.Board = Board;
|
|
32
|
+
Row.Card = Card;
|
|
32
33
|
export default Row;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edu-tosel/design",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.80",
|
|
4
4
|
"description": "UI components for International TOSEL Committee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"tailwind-scrollbar-hide": "^1.1.7",
|
|
30
30
|
"tailwindcss-animate": "^1.0.7",
|
|
31
31
|
"typescript": "^5.2.2",
|
|
32
|
+
"uuid": "^10.0.0",
|
|
32
33
|
"zustand": "^4.5.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {}
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.80
|