@ceed/ads 0.0.22 → 0.0.24
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/dist/components/Button/Button.d.ts +22 -5
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Container/Container.d.ts +1 -1
- package/dist/components/Container/Container.js +16 -12
- package/dist/components/DataTable/DataTable.d.ts +24 -15
- package/dist/components/DataTable/DataTable.js +116 -55
- package/dist/components/DialogFrame/DialogFrame.d.ts +11 -0
- package/dist/components/DialogFrame/DialogFrame.js +44 -0
- package/dist/components/DialogFrame/index.d.ts +3 -0
- package/dist/components/DialogFrame/index.js +3 -0
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +0 -13
- package/dist/components/ThemeProvider/ThemeProvider.js +6 -8
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/framer/index.js +4654 -4494
- package/package.json +1 -1
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ButtonProps } from "@mui/joy";
|
|
3
2
|
import { MotionProps } from "framer-motion";
|
|
4
|
-
declare const Button: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
declare const Button: React.ForwardRefExoticComponent<Omit<{
|
|
4
|
+
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
5
|
+
} & import("@mui/joy").ButtonSlotsAndSlotProps & {
|
|
6
|
+
action?: React.Ref<{
|
|
7
|
+
focusVisible(): void;
|
|
8
|
+
}> | undefined;
|
|
9
|
+
color?: import("@mui/types").OverridableStringUnion<import("@mui/joy").ColorPaletteProp, import("@mui/joy").ButtonPropsColorOverrides> | undefined;
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
endDecorator?: React.ReactNode;
|
|
12
|
+
focusVisibleClassName?: string | undefined;
|
|
13
|
+
fullWidth?: boolean | undefined;
|
|
14
|
+
size?: import("@mui/types").OverridableStringUnion<"sm" | "md" | "lg", import("@mui/joy").ButtonPropsSizeOverrides> | undefined;
|
|
15
|
+
startDecorator?: React.ReactNode;
|
|
16
|
+
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
17
|
+
tabIndex?: number | undefined;
|
|
18
|
+
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").ButtonPropsVariantOverrides> | undefined;
|
|
19
|
+
loading?: boolean | undefined;
|
|
20
|
+
loadingIndicator?: React.ReactNode;
|
|
21
|
+
loadingPosition?: "center" | "end" | "start" | undefined;
|
|
22
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
23
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
24
|
+
}, "color" | "tabIndex" | "variant" | "sx" | "disabled" | "size" | "component" | keyof import("@mui/joy").ButtonSlotsAndSlotProps | "action" | "endDecorator" | "focusVisibleClassName" | "fullWidth" | "startDecorator" | "loading" | "loadingIndicator" | "loadingPosition"> & MotionProps, "ref"> & React.RefAttributes<unknown>>;
|
|
8
25
|
export { Button };
|
|
@@ -9,11 +9,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import React from "react";
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
13
|
import { Button as JoyButton } from "@mui/joy";
|
|
14
14
|
import { motion } from "framer-motion";
|
|
15
15
|
var MotionButton = motion(JoyButton);
|
|
16
|
-
var Button = function (props) {
|
|
16
|
+
var Button = forwardRef(function (props) {
|
|
17
17
|
// prop destruction
|
|
18
18
|
// lib hooks
|
|
19
19
|
// state, ref, querystring hooks
|
|
@@ -23,6 +23,6 @@ var Button = function (props) {
|
|
|
23
23
|
// effects
|
|
24
24
|
// handlers
|
|
25
25
|
return (React.createElement(MotionButton, __assign({}, props)));
|
|
26
|
-
};
|
|
26
|
+
});
|
|
27
27
|
export { Button };
|
|
28
28
|
Button.displayName = "Button";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
declare const Container: React.ForwardRefExoticComponent<Omit<import("@mui/system").MUIStyledCommonProps<import("@mui/joy").Theme> & {
|
|
3
|
-
maxWidth?: "
|
|
3
|
+
maxWidth?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
4
4
|
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export { Container };
|
|
@@ -16,21 +16,25 @@ var ContainerRoot = styled("div", {
|
|
|
16
16
|
slot: "root",
|
|
17
17
|
shouldForwardProp: function (prop) { return prop !== "maxWidth"; },
|
|
18
18
|
})(function (_a) {
|
|
19
|
-
var _b, _c, _d;
|
|
20
|
-
var theme = _a.theme,
|
|
21
|
-
return (__assign(__assign(__assign({ width: "100%", marginLeft: "auto", boxSizing: "border-box", marginRight: "auto", display: "block", paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2) }, (maxWidth === "
|
|
22
|
-
_b[theme.breakpoints.up("
|
|
23
|
-
maxWidth: theme.breakpoints.values.
|
|
19
|
+
var _b, _c, _d, _e;
|
|
20
|
+
var theme = _a.theme, _f = _a.maxWidth, maxWidth = _f === void 0 ? "lg" : _f;
|
|
21
|
+
return (__assign(__assign(__assign(__assign({ width: "100%", marginLeft: "auto", boxSizing: "border-box", marginRight: "auto", display: "block", paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2) }, (maxWidth === "sm" && (_b = {},
|
|
22
|
+
_b[theme.breakpoints.up("xs")] = {
|
|
23
|
+
maxWidth: theme.breakpoints.values.sm,
|
|
24
24
|
},
|
|
25
|
-
_b))), (maxWidth === "
|
|
26
|
-
_c[theme.breakpoints.up("
|
|
27
|
-
maxWidth: theme.breakpoints.values.
|
|
25
|
+
_b))), (maxWidth === "md" && (_c = {},
|
|
26
|
+
_c[theme.breakpoints.up("sm")] = {
|
|
27
|
+
maxWidth: theme.breakpoints.values.md,
|
|
28
28
|
},
|
|
29
|
-
_c))), (maxWidth === "
|
|
30
|
-
_d[theme.breakpoints.up("
|
|
31
|
-
maxWidth: theme.breakpoints.values.
|
|
29
|
+
_c))), (maxWidth === "lg" && (_d = {},
|
|
30
|
+
_d[theme.breakpoints.up("md")] = {
|
|
31
|
+
maxWidth: theme.breakpoints.values.lg,
|
|
32
32
|
},
|
|
33
|
-
_d)))
|
|
33
|
+
_d))), (maxWidth === "xl" && (_e = {},
|
|
34
|
+
_e[theme.breakpoints.up("lg")] = {
|
|
35
|
+
maxWidth: theme.breakpoints.values.xl,
|
|
36
|
+
},
|
|
37
|
+
_e))));
|
|
34
38
|
});
|
|
35
39
|
var Container = forwardRef(function Container(props, ref) {
|
|
36
40
|
// prop destruction
|
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
import React, { ComponentProps } from "react";
|
|
2
|
-
import { Table
|
|
2
|
+
import { Table } from "../Table";
|
|
3
|
+
type Column<T extends Record<string, unknown>> = {
|
|
4
|
+
type?: "number" | "string";
|
|
5
|
+
field: keyof T;
|
|
6
|
+
headerName?: string;
|
|
7
|
+
width?: string;
|
|
8
|
+
minWidth?: string;
|
|
9
|
+
maxWidth?: string;
|
|
10
|
+
resizable?: boolean;
|
|
11
|
+
};
|
|
3
12
|
type DataTableProps<T extends Record<string, unknown>> = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
13
|
+
rows: T[];
|
|
14
|
+
checkboxSelection?: boolean;
|
|
15
|
+
columns: Column<T>[];
|
|
7
16
|
/**
|
|
8
17
|
* 체크박스가 있는 경우, 체크박스를 클릭했을 때 선택된 row의 index를 지정한다.
|
|
9
18
|
*/
|
|
10
19
|
selectionModel?: string[];
|
|
11
20
|
onSelectionModelChange?: (newSelectionModel: string[]) => void;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
paginationModel?: {
|
|
22
|
+
page: number;
|
|
23
|
+
pageSize: number;
|
|
24
|
+
};
|
|
25
|
+
onPaginationModelChange?: (model: {
|
|
26
|
+
page: number;
|
|
27
|
+
pageSize: number;
|
|
28
|
+
}) => void;
|
|
19
29
|
/**
|
|
20
30
|
* Rows의 총 갯수를 직접 지정 할 수 있다.
|
|
21
|
-
*
|
|
22
|
-
* data lazy loading을 위한 prop
|
|
31
|
+
* 기본적으로는 rows.length를 사용하지만, 이 값을 지정하면 rows.length를 사용하지 않는다.
|
|
23
32
|
*/
|
|
24
|
-
|
|
33
|
+
rowCount?: number;
|
|
25
34
|
slots?: {
|
|
26
35
|
checkbox?: React.ElementType;
|
|
27
36
|
toolbar?: React.ElementType;
|
|
@@ -39,7 +48,7 @@ type DataTableProps<T extends Record<string, unknown>> = {
|
|
|
39
48
|
[key: string]: any;
|
|
40
49
|
}>;
|
|
41
50
|
};
|
|
42
|
-
} & ComponentProps<typeof Table
|
|
51
|
+
} & ComponentProps<typeof Table>;
|
|
43
52
|
declare function DataTable<T extends Record<string, unknown>>(props: DataTableProps<T>): React.JSX.Element;
|
|
44
53
|
declare namespace DataTable {
|
|
45
54
|
var displayName: string;
|
|
@@ -29,24 +29,27 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
29
29
|
}
|
|
30
30
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
31
|
};
|
|
32
|
-
import React, { useCallback, useEffect, useMemo, useState, } from "react";
|
|
32
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
33
33
|
import Sheet from "../Sheet";
|
|
34
|
-
import { Table
|
|
34
|
+
import { Table } from "../Table";
|
|
35
35
|
import Checkbox from "../Checkbox";
|
|
36
36
|
import Box from "../Box";
|
|
37
37
|
import Stack from "../Stack";
|
|
38
38
|
import Typography from "../Typography";
|
|
39
39
|
import Button from "../Button";
|
|
40
|
+
var numberFormatter = function (value) {
|
|
41
|
+
return "Intl" in window ? new Intl.NumberFormat().format(value) : value;
|
|
42
|
+
};
|
|
40
43
|
function TablePagination(props) {
|
|
41
44
|
// prop destruction
|
|
42
|
-
var
|
|
45
|
+
var _a = props.paginationModel, page = _a.page, pageSize = _a.pageSize, rowCount = props.rowCount, onPageChange = props.onPageChange;
|
|
43
46
|
// lib hooks
|
|
44
47
|
// state, ref, querystring hooks
|
|
45
48
|
// form hooks
|
|
46
49
|
// query hooks
|
|
47
50
|
// calculated values
|
|
48
51
|
var firstPage = 1;
|
|
49
|
-
var lastPage = Math.ceil(
|
|
52
|
+
var lastPage = Math.ceil(rowCount / pageSize);
|
|
50
53
|
var beforePages = [page - 2, page - 1].filter(function (p) { return p > 1; });
|
|
51
54
|
var afterPages = [page + 1, page + 2].filter(function (p) { return p <= lastPage - 1; });
|
|
52
55
|
var isMoreAfterPages = lastPage > 1 && page < lastPage - 3;
|
|
@@ -69,82 +72,133 @@ function TablePagination(props) {
|
|
|
69
72
|
React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(page + 1); }, disabled: page === lastPage, "aria-label": "Next page" }, ">"))));
|
|
70
73
|
}
|
|
71
74
|
function useDataTableRenderer(_a) {
|
|
72
|
-
var
|
|
73
|
-
var
|
|
75
|
+
var rows = _a.rows, columns = _a.columns, totalRowsProp = _a.rowCount, paginationModel = _a.paginationModel, onPaginationModelChange = _a.onPaginationModelChange, _b = _a.selectionModel, selectionModel = _b === void 0 ? [] : _b, onSelectionModelChange = _a.onSelectionModelChange, stickyHeader = _a.stickyHeader;
|
|
76
|
+
var _c = useState((paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.page) || 1), page = _c[0], setPage = _c[1];
|
|
77
|
+
var pageSize = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSize) || 20;
|
|
74
78
|
var selectedModelSet = useMemo(function () { return new Set(selectionModel); }, [selectionModel]);
|
|
75
|
-
var dataInPage = useMemo(function () {
|
|
76
|
-
return data.slice((page - 1) * rowsPerPage, (page - 1) * rowsPerPage + rowsPerPage);
|
|
77
|
-
}, [data, page, rowsPerPage]);
|
|
79
|
+
var dataInPage = useMemo(function () { return rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize); }, [rows, page, pageSize]);
|
|
78
80
|
var isAllSelected = useMemo(function () {
|
|
79
81
|
return dataInPage.length > 0 &&
|
|
80
82
|
dataInPage.every(function (_, i) {
|
|
81
|
-
return selectedModelSet.has("".concat(i + (page - 1) *
|
|
83
|
+
return selectedModelSet.has("".concat(i + (page - 1) * pageSize));
|
|
82
84
|
});
|
|
83
|
-
}, [dataInPage, selectedModelSet, page,
|
|
84
|
-
var
|
|
85
|
-
var isTotalSelected = useMemo(function () { return
|
|
85
|
+
}, [dataInPage, selectedModelSet, page, pageSize]);
|
|
86
|
+
var rowCount = totalRowsProp || rows.length;
|
|
87
|
+
var isTotalSelected = useMemo(function () { return rowCount > 0 && selectionModel.length === rowCount; }, [selectionModel, rowCount]);
|
|
86
88
|
var handlePageChange = useCallback(function (newPage) {
|
|
87
89
|
setPage(newPage);
|
|
88
|
-
|
|
89
|
-
}, [
|
|
90
|
+
onPaginationModelChange === null || onPaginationModelChange === void 0 ? void 0 : onPaginationModelChange({ page: newPage, pageSize: pageSize });
|
|
91
|
+
}, [onPaginationModelChange]);
|
|
90
92
|
useEffect(function () {
|
|
91
93
|
handlePageChange(1);
|
|
92
|
-
}, [
|
|
94
|
+
}, [rowCount]);
|
|
93
95
|
useEffect(function () {
|
|
94
|
-
if (page > Math.ceil(
|
|
95
|
-
handlePageChange(Math.ceil(
|
|
96
|
+
if (page > Math.ceil(rowCount / pageSize)) {
|
|
97
|
+
handlePageChange(Math.ceil(rowCount / pageSize));
|
|
96
98
|
}
|
|
97
|
-
}, [
|
|
99
|
+
}, [rowCount, pageSize]);
|
|
98
100
|
useEffect(function () {
|
|
99
101
|
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange([]);
|
|
100
102
|
}, [page]);
|
|
101
103
|
return {
|
|
102
|
-
|
|
104
|
+
rowCount: rowCount,
|
|
103
105
|
page: page,
|
|
104
|
-
|
|
106
|
+
pageSize: pageSize,
|
|
107
|
+
onPaginationModelChange: handlePageChange,
|
|
108
|
+
getColumnHeader: useCallback(function (column) {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
var ref = useRef(null);
|
|
111
|
+
var style = useMemo(function () {
|
|
112
|
+
return ({
|
|
113
|
+
width: column.width,
|
|
114
|
+
minWidth: column.minWidth,
|
|
115
|
+
maxWidth: column.maxWidth,
|
|
116
|
+
textAlign: column.type === "number" ? "end" : "start",
|
|
117
|
+
position: stickyHeader ? undefined : "relative",
|
|
118
|
+
});
|
|
119
|
+
}, [column, stickyHeader]);
|
|
120
|
+
useEffect(function () {
|
|
121
|
+
if (column.resizable && ref.current) {
|
|
122
|
+
var resizeObserver_1 = new ResizeObserver(function (entries) {
|
|
123
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
124
|
+
var entry = entries_1[_i];
|
|
125
|
+
var width = entry.contentRect.width;
|
|
126
|
+
if (width && ref.current) {
|
|
127
|
+
ref.current.style.width = "".concat(width, "px");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
resizeObserver_1.observe(ref.current);
|
|
132
|
+
return function () {
|
|
133
|
+
resizeObserver_1.disconnect();
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}, [column.resizable, ref.current]);
|
|
137
|
+
var resizer = ((_a = column.resizable) !== null && _a !== void 0 ? _a : true) ? (React.createElement(Box, { sx: {
|
|
138
|
+
position: "absolute",
|
|
139
|
+
top: 0,
|
|
140
|
+
right: 0,
|
|
141
|
+
bottom: 0,
|
|
142
|
+
width: "4px",
|
|
143
|
+
cursor: "col-resize",
|
|
144
|
+
}, onMouseDown: function (e) {
|
|
145
|
+
var _a;
|
|
146
|
+
var initialX = e.clientX;
|
|
147
|
+
var initialWidth = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
|
|
148
|
+
var onMouseMove = function (e) {
|
|
149
|
+
if (initialWidth && initialX) {
|
|
150
|
+
ref.current.style.width = "".concat(initialWidth + (e.clientX - initialX), "px");
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
var onMouseUp = function () {
|
|
154
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
155
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
156
|
+
};
|
|
157
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
158
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
159
|
+
} })) : null;
|
|
160
|
+
return (React.createElement("th", { ref: ref, key: column.field, style: style }, (_b = column.headerName) !== null && _b !== void 0 ? _b : column.field,
|
|
161
|
+
resizer));
|
|
162
|
+
}, [stickyHeader, columns]),
|
|
105
163
|
dataInPage: dataInPage,
|
|
106
164
|
isAllSelected: isAllSelected, // all rows are selected on this page
|
|
107
165
|
isTotalSelected: isTotalSelected,
|
|
108
166
|
isSelectedRow: useCallback(function (model) { return selectedModelSet.has(model); }, [selectedModelSet]),
|
|
109
167
|
onAllCheckboxChange: useCallback(function () {
|
|
110
|
-
|
|
168
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(isAllSelected
|
|
111
169
|
? []
|
|
112
|
-
: dataInPage.map(function (_, i) { return "".concat(i + (page - 1) *
|
|
170
|
+
: dataInPage.map(function (_, i) { return "".concat(i + (page - 1) * pageSize); }));
|
|
113
171
|
}, [isAllSelected, dataInPage, onSelectionModelChange]),
|
|
114
172
|
onCheckboxChange: useCallback(function (event, selectedModel) {
|
|
115
173
|
if (selectedModelSet.has(selectedModel)) {
|
|
116
174
|
var newSelectionModel = selectionModel.filter(function (model) { return model !== selectedModel; });
|
|
117
175
|
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel);
|
|
118
|
-
onCheckboxChange === null || onCheckboxChange === void 0 ? void 0 : onCheckboxChange(event, selectedModel);
|
|
119
176
|
}
|
|
120
177
|
else {
|
|
121
|
-
|
|
178
|
+
var newSelectionModel = __spreadArray(__spreadArray([], selectionModel, true), [selectedModel], false);
|
|
179
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel);
|
|
122
180
|
}
|
|
123
181
|
}, [selectionModel, onSelectionModelChange]),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return headCells ||
|
|
182
|
+
columns: useMemo(function () {
|
|
183
|
+
return columns ||
|
|
127
184
|
// fallback
|
|
128
|
-
Object.keys(
|
|
129
|
-
|
|
185
|
+
Object.keys(rows[0] || {}).map(function (key) { return ({
|
|
186
|
+
field: key,
|
|
130
187
|
}); });
|
|
131
|
-
}, [
|
|
188
|
+
}, [rows, columns]),
|
|
132
189
|
onTotalSelect: useCallback(function () {
|
|
133
|
-
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(isTotalSelected ? [] :
|
|
134
|
-
}, [isTotalSelected,
|
|
190
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(isTotalSelected ? [] : rows.map(function (_, i) { return "".concat(i); }));
|
|
191
|
+
}, [isTotalSelected, rows, onSelectionModelChange]),
|
|
135
192
|
};
|
|
136
193
|
}
|
|
137
194
|
function DataTable(props) {
|
|
138
195
|
// prop destruction
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
_onCheckboxChange = props.onCheckboxChange, // onCheckboxChange is used in useDataTableRenderer
|
|
144
|
-
_b = props.slots, // onCheckboxChange is used in useDataTableRenderer
|
|
145
|
-
_c = _b === void 0 ? {} : _b, _d = _c.checkbox, RenderCheckbox = _d === void 0 ? Checkbox : _d, Toolbar = _c.toolbar, Footer = _c.footer, _e = props.slotProps, _f = _e === void 0 ? {} : _e, _g = _f.checkbox, checkboxProps = _g === void 0 ? {} : _g, toolbarProps = _f.toolbar, _h = _f.background, backgroundProps = _h === void 0 ? {} : _h, innerProps = __rest(props, ["data", "showCheckbox", "headCells", "cellOrder", "selectionModel", "onSelectionModelChange", "totalRows", "rowsPerPage", "page", "onPageChange", "onCheckboxChange", "slots", "slotProps"]);
|
|
196
|
+
var rows = props.rows, checkboxSelection = props.checkboxSelection, selectionModel = props.selectionModel, onSelectionModelChange = props.onSelectionModelChange, _ = props.rowCount, // rowCount is used in useDataTableRenderer
|
|
197
|
+
__ = props.columns, // columns is used in useDataTableRenderer
|
|
198
|
+
___ = props.onPaginationModelChange, // onPaginationModelChange is used in useDataTableRenderer
|
|
199
|
+
paginationModel = props.paginationModel, _a = props.slots, _b = _a === void 0 ? {} : _a, _c = _b.checkbox, RenderCheckbox = _c === void 0 ? Checkbox : _c, Toolbar = _b.toolbar, Footer = _b.footer, _d = props.slotProps, _e = _d === void 0 ? {} : _d, _f = _e.checkbox, checkboxProps = _f === void 0 ? {} : _f, toolbarProps = _e.toolbar, _g = _e.background, backgroundProps = _g === void 0 ? {} : _g, innerProps = __rest(props, ["rows", "checkboxSelection", "selectionModel", "onSelectionModelChange", "rowCount", "columns", "onPaginationModelChange", "paginationModel", "slots", "slotProps"]);
|
|
146
200
|
// lib hooks
|
|
147
|
-
var
|
|
201
|
+
var _h = useDataTableRenderer(props), columns = _h.columns, isAllSelected = _h.isAllSelected, isSelectedRow = _h.isSelectedRow, onAllCheckboxChange = _h.onAllCheckboxChange, onCheckboxChange = _h.onCheckboxChange, rowCount = _h.rowCount, page = _h.page, pageSize = _h.pageSize, onPaginationModelChange = _h.onPaginationModelChange, dataInPage = _h.dataInPage, isTotalSelected = _h.isTotalSelected, onTotalSelect = _h.onTotalSelect, getColumnHeader = _h.getColumnHeader;
|
|
148
202
|
// state, ref, querystring hooks
|
|
149
203
|
// form hooks
|
|
150
204
|
// query hooks
|
|
@@ -158,21 +212,21 @@ function DataTable(props) {
|
|
|
158
212
|
}, justifyContent: "space-between", alignItems: "center" },
|
|
159
213
|
React.createElement(Stack, { direction: "row", spacing: 1 },
|
|
160
214
|
!isAllSelected && (React.createElement(Typography, { level: "body-xs" },
|
|
161
|
-
(selectionModel === null || selectionModel === void 0 ? void 0 : selectionModel.length) || 0,
|
|
215
|
+
numberFormatter((selectionModel === null || selectionModel === void 0 ? void 0 : selectionModel.length) || 0),
|
|
162
216
|
" items selected")),
|
|
163
217
|
isAllSelected && !isTotalSelected && (React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
|
|
164
218
|
React.createElement(Typography, { level: "body-xs" },
|
|
165
|
-
"All ",
|
|
166
|
-
selectionModel.length,
|
|
219
|
+
"All ",
|
|
220
|
+
numberFormatter((selectionModel === null || selectionModel === void 0 ? void 0 : selectionModel.length) || 0),
|
|
167
221
|
" items on this page are selected."),
|
|
168
222
|
React.createElement(Button, { size: "sm", variant: "plain", onClick: onTotalSelect },
|
|
169
223
|
"Select all ",
|
|
170
|
-
|
|
224
|
+
numberFormatter(rows.length),
|
|
171
225
|
" items"))),
|
|
172
226
|
isTotalSelected && (React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
|
|
173
227
|
React.createElement(Typography, { level: "body-xs" },
|
|
174
228
|
"All ",
|
|
175
|
-
|
|
229
|
+
numberFormatter(rows.length),
|
|
176
230
|
" items are selected."),
|
|
177
231
|
React.createElement(Button, { size: "sm", variant: "plain", color: "danger", onClick: onTotalSelect }, "Cancel")))),
|
|
178
232
|
Toolbar && React.createElement(Toolbar, __assign({}, (toolbarProps || {})))),
|
|
@@ -190,14 +244,19 @@ function DataTable(props) {
|
|
|
190
244
|
},
|
|
191
245
|
},
|
|
192
246
|
] }, innerProps),
|
|
193
|
-
React.createElement(
|
|
194
|
-
|
|
195
|
-
|
|
247
|
+
React.createElement("thead", null,
|
|
248
|
+
React.createElement("tr", null,
|
|
249
|
+
checkboxSelection && (React.createElement("th", { style: {
|
|
250
|
+
width: "40px",
|
|
251
|
+
textAlign: "center",
|
|
252
|
+
} },
|
|
253
|
+
React.createElement(RenderCheckbox, __assign({ onChange: onAllCheckboxChange, checked: isAllSelected, indeterminate: (selectionModel || []).length > 0 && !isAllSelected }, checkboxProps)))),
|
|
254
|
+
columns.map(getColumnHeader))),
|
|
196
255
|
React.createElement("tbody", null, dataInPage.map(function (row, rowIndex) {
|
|
197
|
-
var rowId = "".concat(rowIndex + (page - 1) *
|
|
198
|
-
return (React.createElement("tr", { key: rowId, role:
|
|
256
|
+
var rowId = "".concat(rowIndex + (page - 1) * pageSize);
|
|
257
|
+
return (React.createElement("tr", { key: rowId, role: checkboxSelection ? "checkbox" : undefined, tabIndex: checkboxSelection ? -1 : undefined, onClick: checkboxSelection
|
|
199
258
|
? function (e) { return onCheckboxChange(e, rowId); }
|
|
200
|
-
: undefined, "aria-checked":
|
|
259
|
+
: undefined, "aria-checked": checkboxSelection ? isSelectedRow(rowId) : undefined, style: checkboxSelection && isSelectedRow(rowId)
|
|
201
260
|
? {
|
|
202
261
|
"--TableCell-dataBackground": "var(--TableCell-selectedBackground)",
|
|
203
262
|
"--TableCell-headBackground": "var(--TableCell-selectedBackground)",
|
|
@@ -205,14 +264,16 @@ function DataTable(props) {
|
|
|
205
264
|
: {
|
|
206
265
|
"--TableCell-headBackground": "transparent",
|
|
207
266
|
} },
|
|
208
|
-
|
|
267
|
+
checkboxSelection && (React.createElement("th", { scope: "row", style: {
|
|
209
268
|
textAlign: "center",
|
|
210
269
|
} },
|
|
211
270
|
React.createElement(RenderCheckbox, __assign({ onChange: function (e) { return onCheckboxChange(e, rowId); }, checked: isSelectedRow(rowId) }, checkboxProps)))),
|
|
212
|
-
|
|
271
|
+
columns.map(function (column) { return (React.createElement("td", { key: column.field, style: {
|
|
272
|
+
textAlign: column.type === "number" ? "end" : "start",
|
|
273
|
+
} }, row[column.field])); })));
|
|
213
274
|
})),
|
|
214
275
|
Footer && React.createElement(Footer, null))),
|
|
215
|
-
React.createElement(TablePagination, { page: page,
|
|
276
|
+
React.createElement(TablePagination, { paginationModel: { page: page, pageSize: pageSize }, rowCount: rowCount, onPageChange: onPaginationModelChange, onRowsPerPageChange: function () { } })));
|
|
216
277
|
}
|
|
217
278
|
export { DataTable };
|
|
218
279
|
DataTable.displayName = "DataTable";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ModalDialog } from "../Modal";
|
|
3
|
+
declare function DialogFrame(props: {
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
actions: React.ReactNode;
|
|
7
|
+
} & React.ComponentProps<typeof ModalDialog>): React.JSX.Element;
|
|
8
|
+
declare namespace DialogFrame {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
export { DialogFrame };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from "react";
|
|
24
|
+
import DialogTitle from "../DialogTitle";
|
|
25
|
+
import DialogContent from "../DialogContent";
|
|
26
|
+
import { ModalDialog } from "../Modal";
|
|
27
|
+
import DialogActions from "../DialogActions";
|
|
28
|
+
function DialogFrame(props) {
|
|
29
|
+
// prop destruction
|
|
30
|
+
var title = props.title, children = props.children, actions = props.actions, innerProps = __rest(props, ["title", "children", "actions"]);
|
|
31
|
+
// lib hooks
|
|
32
|
+
// state, ref, querystring hooks
|
|
33
|
+
// form hooks
|
|
34
|
+
// query hooks
|
|
35
|
+
// calculated values
|
|
36
|
+
// effects
|
|
37
|
+
// handlers
|
|
38
|
+
return (React.createElement(ModalDialog, __assign({}, innerProps),
|
|
39
|
+
React.createElement(DialogTitle, null, title),
|
|
40
|
+
React.createElement(DialogContent, null, children),
|
|
41
|
+
React.createElement(DialogActions, null, actions)));
|
|
42
|
+
}
|
|
43
|
+
export { DialogFrame };
|
|
44
|
+
DialogFrame.displayName = "DialogFrame";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
declare const Modal: import("framer-motion").CustomDomComponent<Pick<import("@mui/base").ModalOwnProps, "children" | "container" | "open" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted"> & {
|
|
3
|
-
onClose?: ((event: {}, reason: "
|
|
3
|
+
onClose?: ((event: {}, reason: "escapeKeyDown" | "backdropClick" | "closeClick") => void) | undefined;
|
|
4
4
|
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
5
5
|
} & import("@mui/joy").ModalSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
6
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare module "@mui/joy/styles" {
|
|
3
|
-
interface BreakpointOverrides {
|
|
4
|
-
xs: false;
|
|
5
|
-
sm: false;
|
|
6
|
-
md: false;
|
|
7
|
-
lg: false;
|
|
8
|
-
xl: false;
|
|
9
|
-
mobile: true;
|
|
10
|
-
tablet: true;
|
|
11
|
-
laptop: true;
|
|
12
|
-
desktop: true;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
2
|
declare function ThemeProvider(props: {
|
|
16
3
|
children?: React.ReactNode;
|
|
17
4
|
}): React.JSX.Element;
|
|
@@ -2,14 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { CssBaseline, CssVarsProvider, checkboxClasses, extendTheme, } from "@mui/joy";
|
|
3
3
|
var defaultTheme = extendTheme({
|
|
4
4
|
cssVarPrefix: "ceed",
|
|
5
|
-
breakpoints: {
|
|
6
|
-
values: {
|
|
7
|
-
mobile: 0,
|
|
8
|
-
tablet: 768,
|
|
9
|
-
laptop: 1024,
|
|
10
|
-
desktop: 1280,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
5
|
components: {
|
|
14
6
|
JoyTable: {
|
|
15
7
|
defaultProps: {
|
|
@@ -29,6 +21,12 @@ var defaultTheme = extendTheme({
|
|
|
29
21
|
},
|
|
30
22
|
},
|
|
31
23
|
},
|
|
24
|
+
JoyTooltip: {
|
|
25
|
+
defaultProps: {
|
|
26
|
+
size: "sm",
|
|
27
|
+
placement: "top",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
32
30
|
},
|
|
33
31
|
});
|
|
34
32
|
function ThemeProvider(props) {
|
|
@@ -7,6 +7,7 @@ export { DataTable } from "./DataTable";
|
|
|
7
7
|
export { DialogActions } from "./DialogActions";
|
|
8
8
|
export { DialogContent } from "./DialogContent";
|
|
9
9
|
export { DialogTitle } from "./DialogTitle";
|
|
10
|
+
export { DialogFrame } from "./DialogFrame";
|
|
10
11
|
export { Divider } from "./Divider";
|
|
11
12
|
export { InsetDrawer } from "./InsetDrawer";
|
|
12
13
|
export { Dropdown } from "./Dropdown";
|
package/dist/components/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { DataTable } from "./DataTable";
|
|
|
7
7
|
export { DialogActions } from "./DialogActions";
|
|
8
8
|
export { DialogContent } from "./DialogContent";
|
|
9
9
|
export { DialogTitle } from "./DialogTitle";
|
|
10
|
+
export { DialogFrame } from "./DialogFrame";
|
|
10
11
|
export { Divider } from "./Divider";
|
|
11
12
|
export { InsetDrawer } from "./InsetDrawer";
|
|
12
13
|
export { Dropdown } from "./Dropdown";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { boxClasses, buttonClasses, checkboxClasses, dividerClasses, iconButtonClasses, inputClasses, menuClasses, menuButtonClasses, menuItemClasses, optionClasses, radioClasses, radioGroupClasses, selectClasses, switchClasses, tableClasses, textareaClasses, typographyClasses, formControlClasses, formLabelClasses, formHelperTextClasses, gridClasses, stackClasses, sheetClasses, modalClasses, modalCloseClasses, modalDialogClasses, modalOverflowClasses, dialogTitleClasses, dialogContentClasses, dialogActionsClasses, tooltipClasses, tabsClasses, tabListClasses, tabPanelClasses, accordionClasses, accordionDetailsClasses, accordionGroupClasses as accordionsClasses, accordionSummaryClasses, Avatar, avatarClasses, AvatarGroup, avatarGroupClasses, AspectRatio, aspectRatioClasses, Badge, badgeClasses, Breadcrumbs, breadcrumbsClasses, Card, cardClasses, CardActions, cardActionsClasses, CardContent, cardContentClasses, CardCover, cardCoverClasses, CardOverflow, cardOverflowClasses, Chip, chipClasses, CircularProgress, circularProgressClasses, Drawer, drawerClasses, LinearProgress, linearProgressClasses, List, listClasses, ListDivider, listDividerClasses, ListItem, listItemClasses, ListItemButton, listItemButtonClasses, ListItemContent, listItemContentClasses, ListItemDecorator, listItemDecoratorClasses, ListSubheader, listSubheaderClasses, Link, linkClasses, Slider, sliderClasses, Step, stepClasses, StepButton, stepButtonClasses, StepIndicator, Stepper, stepperClasses, Skeleton, skeletonClasses, } from "@mui/joy";
|
|
2
|
-
export { Accordion, Accordions, AccordionDetails, AccordionSummary, Box, Button, Checkbox, Container, DataTable, DialogActions, DialogContent, DialogTitle, Divider, Dropdown, InsetDrawer, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Menu, MenuButton, MenuItem, Modal, ModalClose, ModalDialog, ModalOverflow, ModalFrame, Radio, RadioGroup, RadioList, Select, Option, Sheet, Stack, Switch, Table, TableHead, TableBody, Tabs, Tab, TabList, TabPanel, Textarea, ThemeProvider, Tooltip, Typography, } from "./components";
|
|
2
|
+
export { Accordion, Accordions, AccordionDetails, AccordionSummary, Box, Button, Checkbox, Container, DataTable, DialogActions, DialogContent, DialogTitle, DialogFrame, Divider, Dropdown, InsetDrawer, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Menu, MenuButton, MenuItem, Modal, ModalClose, ModalDialog, ModalOverflow, ModalFrame, Radio, RadioGroup, RadioList, Select, Option, Sheet, Stack, Switch, Table, TableHead, TableBody, Tabs, Tab, TabList, TabPanel, Textarea, ThemeProvider, Tooltip, Typography, } from "./components";
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export {
|
|
|
3
3
|
boxClasses, buttonClasses, checkboxClasses, dividerClasses, iconButtonClasses, inputClasses, menuClasses, menuButtonClasses, menuItemClasses, optionClasses, radioClasses, radioGroupClasses, selectClasses, switchClasses, tableClasses, textareaClasses, typographyClasses, formControlClasses, formLabelClasses, formHelperTextClasses, gridClasses, stackClasses, sheetClasses, modalClasses, modalCloseClasses, modalDialogClasses, modalOverflowClasses, dialogTitleClasses, dialogContentClasses, dialogActionsClasses, tooltipClasses, tabsClasses, tabListClasses, tabPanelClasses,
|
|
4
4
|
// Pure JoyUI
|
|
5
5
|
accordionClasses, accordionDetailsClasses, accordionGroupClasses as accordionsClasses, accordionSummaryClasses, Avatar, avatarClasses, AvatarGroup, avatarGroupClasses, AspectRatio, aspectRatioClasses, Badge, badgeClasses, Breadcrumbs, breadcrumbsClasses, Card, cardClasses, CardActions, cardActionsClasses, CardContent, cardContentClasses, CardCover, cardCoverClasses, CardOverflow, cardOverflowClasses, Chip, chipClasses, CircularProgress, circularProgressClasses, Drawer, drawerClasses, LinearProgress, linearProgressClasses, List, listClasses, ListDivider, listDividerClasses, ListItem, listItemClasses, ListItemButton, listItemButtonClasses, ListItemContent, listItemContentClasses, ListItemDecorator, listItemDecoratorClasses, ListSubheader, listSubheaderClasses, Link, linkClasses, Slider, sliderClasses, Step, stepClasses, StepButton, stepButtonClasses, StepIndicator, Stepper, stepperClasses, Skeleton, skeletonClasses, } from "@mui/joy";
|
|
6
|
-
export { Accordion, Accordions, AccordionDetails, AccordionSummary, Box, Button, Checkbox, Container, DataTable, DialogActions, DialogContent, DialogTitle, Divider, Dropdown, InsetDrawer, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Menu, MenuButton, MenuItem, Modal, ModalClose, ModalDialog, ModalOverflow, ModalFrame, Radio, RadioGroup, RadioList, Select, Option, Sheet, Stack, Switch, Table, TableHead, TableBody, Tabs, Tab, TabList, TabPanel, Textarea, ThemeProvider, Tooltip, Typography, } from "./components";
|
|
6
|
+
export { Accordion, Accordions, AccordionDetails, AccordionSummary, Box, Button, Checkbox, Container, DataTable, DialogActions, DialogContent, DialogTitle, DialogFrame, Divider, Dropdown, InsetDrawer, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Menu, MenuButton, MenuItem, Modal, ModalClose, ModalDialog, ModalOverflow, ModalFrame, Radio, RadioGroup, RadioList, Select, Option, Sheet, Stack, Switch, Table, TableHead, TableBody, Tabs, Tab, TabList, TabPanel, Textarea, ThemeProvider, Tooltip, Typography, } from "./components";
|