@ceed/ads 0.0.17 → 0.0.19
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/Accordions/Accordions.d.ts +66 -0
- package/dist/components/Accordions/Accordions.js +66 -0
- package/dist/components/Accordions/index.d.ts +3 -0
- package/dist/components/Accordions/index.js +3 -0
- package/dist/components/DataTable/DataTable.d.ts +33 -5
- package/dist/components/DataTable/DataTable.js +186 -49
- package/dist/components/DialogTitle/DialogTitle.d.ts +1 -1
- package/dist/components/Grid/Grid.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts +3 -3
- package/dist/components/Radio/Radio.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Sheet/Sheet.d.ts +1 -1
- package/dist/components/Stack/Stack.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +7 -7
- package/dist/components/ThemeProvider/ThemeProvider.js +6 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/framer/index.js +5003 -4454
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const AccordionSummary: import("framer-motion").CustomDomComponent<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
color?: import("@mui/types").OverridableStringUnion<import("@mui/joy").ColorPaletteProp, import("@mui/joy").AccordionSummaryPropsColorOverrides> | undefined;
|
|
5
|
+
indicator?: React.ReactNode;
|
|
6
|
+
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").AccordionSummaryPropsVariantOverrides> | undefined;
|
|
7
|
+
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
8
|
+
} & import("@mui/joy").AccordionSummarySlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
+
}, "children" | "color" | "indicator" | "variant" | "sx" | keyof import("@mui/joy").AccordionSummarySlotsAndSlotProps>>;
|
|
11
|
+
export { AccordionSummary };
|
|
12
|
+
declare const AccordionDetails: import("framer-motion").CustomDomComponent<{
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
color?: import("@mui/types").OverridableStringUnion<import("@mui/joy").ColorPaletteProp, import("@mui/joy").AccordionDetailsPropsColorOverrides> | undefined;
|
|
15
|
+
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").AccordionDetailsPropsVariantOverrides> | undefined;
|
|
16
|
+
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
17
|
+
} & import("@mui/joy").AccordionDetailsSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
19
|
+
}, "children" | "color" | "variant" | "sx" | keyof import("@mui/joy").AccordionDetailsSlotsAndSlotProps>>;
|
|
20
|
+
export { AccordionDetails };
|
|
21
|
+
declare const MotionAccordion: import("framer-motion").CustomDomComponent<{
|
|
22
|
+
accordionId?: string | undefined;
|
|
23
|
+
color?: import("@mui/types").OverridableStringUnion<import("@mui/joy").ColorPaletteProp, import("@mui/joy").AccordionPropsColorOverrides> | undefined;
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
defaultExpanded?: boolean | undefined;
|
|
26
|
+
disabled?: boolean | undefined;
|
|
27
|
+
expanded?: boolean | undefined;
|
|
28
|
+
onChange?: ((event: React.SyntheticEvent<Element, Event>, expanded: boolean) => void) | undefined;
|
|
29
|
+
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").AccordionPropsVariantOverrides> | undefined;
|
|
30
|
+
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
31
|
+
} & import("@mui/joy").AccordionSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
32
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
33
|
+
}, "children" | "color" | "onChange" | "variant" | "sx" | "accordionId" | "defaultExpanded" | "disabled" | "expanded" | keyof import("@mui/joy").AccordionSlotsAndSlotProps>>;
|
|
34
|
+
declare function Accordion(props: {
|
|
35
|
+
summary: React.ReactNode;
|
|
36
|
+
details: React.ReactNode;
|
|
37
|
+
index: number;
|
|
38
|
+
} & React.ComponentProps<typeof MotionAccordion>): React.JSX.Element;
|
|
39
|
+
declare namespace Accordion {
|
|
40
|
+
var displayName: string;
|
|
41
|
+
}
|
|
42
|
+
export { Accordion };
|
|
43
|
+
declare const MotionAccordions: import("framer-motion").CustomDomComponent<{
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
color?: import("@mui/types").OverridableStringUnion<import("@mui/joy").ColorPaletteProp, import("@mui/joy").AccordionGroupPropsColorOverrides> | undefined;
|
|
46
|
+
disableDivider?: boolean | undefined;
|
|
47
|
+
size?: import("@mui/types").OverridableStringUnion<"sm" | "md" | "lg", import("@mui/joy").AccordionGroupPropsSizeOverrides> | undefined;
|
|
48
|
+
transition?: string | {
|
|
49
|
+
initial: string;
|
|
50
|
+
expanded: string;
|
|
51
|
+
} | undefined;
|
|
52
|
+
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").AccordionGroupPropsVariantOverrides> | undefined;
|
|
53
|
+
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
54
|
+
} & import("@mui/joy").AccordionGroupSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
55
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
56
|
+
}, "children" | "transition" | "color" | "variant" | "sx" | "disableDivider" | "size" | keyof import("@mui/joy").AccordionGroupSlotsAndSlotProps>>;
|
|
57
|
+
declare function Accordions(props: {
|
|
58
|
+
items: {
|
|
59
|
+
summary: string;
|
|
60
|
+
details: React.ReactNode;
|
|
61
|
+
}[];
|
|
62
|
+
} & React.ComponentProps<typeof MotionAccordions>): React.JSX.Element;
|
|
63
|
+
declare namespace Accordions {
|
|
64
|
+
var displayName: string;
|
|
65
|
+
}
|
|
66
|
+
export { Accordions };
|
|
@@ -0,0 +1,66 @@
|
|
|
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 { AccordionGroup as JoyAccordionGroup, Accordion as JoyAccordion, AccordionSummary as JoyAccordionSummary, AccordionDetails as JoyAccordionDetails, } from "@mui/joy";
|
|
25
|
+
import { motion } from "framer-motion";
|
|
26
|
+
var MotionAccordionSummary = motion(JoyAccordionSummary);
|
|
27
|
+
var AccordionSummary = MotionAccordionSummary;
|
|
28
|
+
export { AccordionSummary };
|
|
29
|
+
AccordionSummary.displayName = "AccordionSummary";
|
|
30
|
+
var MotionAccordionDetails = motion(JoyAccordionDetails);
|
|
31
|
+
var AccordionDetails = MotionAccordionDetails;
|
|
32
|
+
export { AccordionDetails };
|
|
33
|
+
AccordionDetails.displayName = "AccordionDetails";
|
|
34
|
+
var MotionAccordion = motion(JoyAccordion);
|
|
35
|
+
function Accordion(props) {
|
|
36
|
+
// prop destruction
|
|
37
|
+
var summary = props.summary, details = props.details, variant = props.variant, color = props.color, innerProps = __rest(props, ["summary", "details", "variant", "color"]);
|
|
38
|
+
// lib hooks
|
|
39
|
+
// state, ref, querystring hooks
|
|
40
|
+
// form hooks
|
|
41
|
+
// query hooks
|
|
42
|
+
// calculated values
|
|
43
|
+
var inheritedVariant = variant === "solid" ? "solid" : undefined;
|
|
44
|
+
// effects
|
|
45
|
+
// handlers
|
|
46
|
+
return (React.createElement(MotionAccordion, __assign({ variant: inheritedVariant, color: color }, innerProps),
|
|
47
|
+
React.createElement(AccordionSummary, { variant: inheritedVariant, color: color }, summary),
|
|
48
|
+
React.createElement(AccordionDetails, { variant: inheritedVariant, color: color }, details)));
|
|
49
|
+
}
|
|
50
|
+
export { Accordion };
|
|
51
|
+
Accordion.displayName = "Accordion";
|
|
52
|
+
var MotionAccordions = motion(JoyAccordionGroup);
|
|
53
|
+
function Accordions(props) {
|
|
54
|
+
// prop destruction
|
|
55
|
+
var variant = props.variant, color = props.color, items = props.items, innerProps = __rest(props, ["variant", "color", "items"]);
|
|
56
|
+
// lib hooks
|
|
57
|
+
// state, ref, querystring hooks
|
|
58
|
+
// form hooks
|
|
59
|
+
// query hooks
|
|
60
|
+
// calculated values
|
|
61
|
+
// effects
|
|
62
|
+
// handlers
|
|
63
|
+
return (React.createElement(MotionAccordions, __assign({ variant: variant, color: color }, innerProps), items.map(function (item, index) { return (React.createElement(Accordion, { summary: item.summary, details: item.details, index: index, variant: variant, color: color })); })));
|
|
64
|
+
}
|
|
65
|
+
export { Accordions };
|
|
66
|
+
Accordions.displayName = "Accordions";
|
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import React, { ComponentProps } from "react";
|
|
2
|
-
import { Table
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { Table } from "../Table";
|
|
3
|
+
type DataTableProps<T extends Record<string, unknown>> = {
|
|
4
|
+
rows: T[];
|
|
5
|
+
checkboxSelection?: boolean;
|
|
6
|
+
columns: {
|
|
7
|
+
type?: "number" | "string";
|
|
8
|
+
field: keyof T;
|
|
9
|
+
headerName?: string;
|
|
10
|
+
width?: string;
|
|
11
|
+
minWidth?: string;
|
|
12
|
+
maxWidth?: string;
|
|
13
|
+
}[];
|
|
14
|
+
/**
|
|
15
|
+
* 체크박스가 있는 경우, 체크박스를 클릭했을 때 선택된 row의 index를 지정한다.
|
|
16
|
+
*/
|
|
17
|
+
selectionModel?: string[];
|
|
18
|
+
onSelectionModelChange?: (newSelectionModel: string[]) => void;
|
|
19
|
+
paginationModel?: {
|
|
20
|
+
page: number;
|
|
21
|
+
pageSize: number;
|
|
22
|
+
};
|
|
23
|
+
onPaginationModelChange?: (newPage: number) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Rows의 총 갯수를 직접 지정 할 수 있다.
|
|
26
|
+
* 기본적으로는 rows.length를 사용하지만, 이 값을 지정하면 rows.length를 사용하지 않는다.
|
|
27
|
+
*/
|
|
28
|
+
rowCount?: number;
|
|
6
29
|
slots?: {
|
|
7
30
|
checkbox?: React.ElementType;
|
|
8
31
|
toolbar?: React.ElementType;
|
|
32
|
+
footer?: React.ElementType;
|
|
9
33
|
};
|
|
10
34
|
slotProps?: {
|
|
11
35
|
checkbox?: Partial<{
|
|
@@ -15,8 +39,12 @@ declare function DataTable<T extends Record<string, unknown>>(props: {
|
|
|
15
39
|
toolbar?: Partial<{
|
|
16
40
|
[key: string]: any;
|
|
17
41
|
}>;
|
|
42
|
+
background?: Partial<{
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}>;
|
|
18
45
|
};
|
|
19
|
-
} & ComponentProps<typeof Table
|
|
46
|
+
} & ComponentProps<typeof Table>;
|
|
47
|
+
declare function DataTable<T extends Record<string, unknown>>(props: DataTableProps<T>): React.JSX.Element;
|
|
20
48
|
declare namespace DataTable {
|
|
21
49
|
var displayName: string;
|
|
22
50
|
}
|
|
@@ -20,74 +20,211 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
32
|
+
import React, { useCallback, useEffect, useMemo, useState, } from "react";
|
|
24
33
|
import Sheet from "../Sheet";
|
|
25
|
-
import { Table
|
|
34
|
+
import { Table } from "../Table";
|
|
26
35
|
import Checkbox from "../Checkbox";
|
|
36
|
+
import Box from "../Box";
|
|
37
|
+
import Stack from "../Stack";
|
|
38
|
+
import Typography from "../Typography";
|
|
39
|
+
import Button from "../Button";
|
|
40
|
+
var numberFormatter = function (value) {
|
|
41
|
+
return "Intl" in window ? new Intl.NumberFormat().format(value) : value;
|
|
42
|
+
};
|
|
43
|
+
function TablePagination(props) {
|
|
44
|
+
// prop destruction
|
|
45
|
+
var _a = props.paginationModel, page = _a.page, pageSize = _a.pageSize, rowCount = props.rowCount, onPageChange = props.onPageChange;
|
|
46
|
+
// lib hooks
|
|
47
|
+
// state, ref, querystring hooks
|
|
48
|
+
// form hooks
|
|
49
|
+
// query hooks
|
|
50
|
+
// calculated values
|
|
51
|
+
var firstPage = 1;
|
|
52
|
+
var lastPage = Math.ceil(rowCount / pageSize);
|
|
53
|
+
var beforePages = [page - 2, page - 1].filter(function (p) { return p > 1; });
|
|
54
|
+
var afterPages = [page + 1, page + 2].filter(function (p) { return p <= lastPage - 1; });
|
|
55
|
+
var isMoreAfterPages = lastPage > 1 && page < lastPage - 3;
|
|
56
|
+
var isMoreBeforePages = lastPage > 1 && page > 4;
|
|
57
|
+
// effects
|
|
58
|
+
// handlers
|
|
59
|
+
return (React.createElement(Stack, { direction: "row", spacing: 1, sx: {
|
|
60
|
+
pt: 1,
|
|
61
|
+
pb: 1,
|
|
62
|
+
}, justifyContent: "end", alignItems: "center" },
|
|
63
|
+
React.createElement(Stack, { direction: "row", spacing: 0.5, alignItems: "center" },
|
|
64
|
+
React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(page - 1); }, disabled: page === firstPage, "aria-label": "Previous page" }, "<"),
|
|
65
|
+
page !== firstPage && (React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(firstPage); } }, firstPage)),
|
|
66
|
+
isMoreBeforePages && (React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(page - 3); } }, "...")),
|
|
67
|
+
beforePages.map(function (p) { return (React.createElement(Button, { key: p, size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(p); } }, p)); }),
|
|
68
|
+
React.createElement(Button, { variant: "soft", size: "sm" }, page),
|
|
69
|
+
afterPages.map(function (p) { return (React.createElement(Button, { key: p, size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(p); } }, p)); }),
|
|
70
|
+
isMoreAfterPages && (React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(page + 3); } }, "...")),
|
|
71
|
+
page !== lastPage && (React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(lastPage); } }, lastPage)),
|
|
72
|
+
React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(page + 1); }, disabled: page === lastPage, "aria-label": "Next page" }, ">"))));
|
|
73
|
+
}
|
|
27
74
|
function useDataTableRenderer(_a) {
|
|
28
|
-
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;
|
|
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;
|
|
78
|
+
var selectedModelSet = useMemo(function () { return new Set(selectionModel); }, [selectionModel]);
|
|
79
|
+
var dataInPage = useMemo(function () { return rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize); }, [rows, page, pageSize]);
|
|
80
|
+
var isAllSelected = useMemo(function () {
|
|
81
|
+
return dataInPage.length > 0 &&
|
|
82
|
+
dataInPage.every(function (_, i) {
|
|
83
|
+
return selectedModelSet.has("".concat(i + (page - 1) * pageSize));
|
|
84
|
+
});
|
|
85
|
+
}, [dataInPage, selectedModelSet, page, pageSize]);
|
|
86
|
+
var rowCount = totalRowsProp || rows.length;
|
|
87
|
+
var isTotalSelected = useMemo(function () { return rowCount > 0 && selectionModel.length === rowCount; }, [selectionModel, rowCount]);
|
|
88
|
+
var handlePageChange = useCallback(function (newPage) {
|
|
89
|
+
setPage(newPage);
|
|
90
|
+
onPaginationModelChange === null || onPaginationModelChange === void 0 ? void 0 : onPaginationModelChange(newPage);
|
|
91
|
+
}, [onPaginationModelChange]);
|
|
92
|
+
useEffect(function () {
|
|
93
|
+
handlePageChange(1);
|
|
94
|
+
}, [rowCount]);
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
if (page > Math.ceil(rowCount / pageSize)) {
|
|
97
|
+
handlePageChange(Math.ceil(rowCount / pageSize));
|
|
98
|
+
}
|
|
99
|
+
}, [rowCount, pageSize]);
|
|
100
|
+
useEffect(function () {
|
|
101
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange([]);
|
|
102
|
+
}, [page]);
|
|
29
103
|
return {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
104
|
+
rowCount: rowCount,
|
|
105
|
+
page: page,
|
|
106
|
+
pageSize: pageSize,
|
|
107
|
+
onPaginationModelChange: handlePageChange,
|
|
108
|
+
dataInPage: dataInPage,
|
|
109
|
+
isAllSelected: isAllSelected, // all rows are selected on this page
|
|
110
|
+
isTotalSelected: isTotalSelected,
|
|
111
|
+
isSelectedRow: useCallback(function (model) { return selectedModelSet.has(model); }, [selectedModelSet]),
|
|
112
|
+
onAllCheckboxChange: useCallback(function () {
|
|
113
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(isAllSelected
|
|
114
|
+
? []
|
|
115
|
+
: dataInPage.map(function (_, i) { return "".concat(i + (page - 1) * pageSize); }));
|
|
116
|
+
}, [isAllSelected, dataInPage, onSelectionModelChange]),
|
|
117
|
+
onCheckboxChange: useCallback(function (event, selectedModel) {
|
|
118
|
+
if (selectedModelSet.has(selectedModel)) {
|
|
119
|
+
var newSelectionModel = selectionModel.filter(function (model) { return model !== selectedModel; });
|
|
120
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
var newSelectionModel = __spreadArray(__spreadArray([], selectionModel, true), [selectedModel], false);
|
|
124
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel);
|
|
125
|
+
}
|
|
126
|
+
}, [selectionModel, onSelectionModelChange]),
|
|
127
|
+
columns: useMemo(function () {
|
|
128
|
+
return columns ||
|
|
33
129
|
// fallback
|
|
34
|
-
Object.keys(
|
|
35
|
-
|
|
130
|
+
Object.keys(rows[0] || {}).map(function (key) { return ({
|
|
131
|
+
field: key,
|
|
36
132
|
}); });
|
|
37
|
-
}, [
|
|
133
|
+
}, [rows, columns]),
|
|
134
|
+
onTotalSelect: useCallback(function () {
|
|
135
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(isTotalSelected ? [] : rows.map(function (_, i) { return "".concat(i); }));
|
|
136
|
+
}, [isTotalSelected, rows, onSelectionModelChange]),
|
|
38
137
|
};
|
|
39
138
|
}
|
|
40
139
|
function DataTable(props) {
|
|
41
140
|
// prop destruction
|
|
42
|
-
var
|
|
141
|
+
var rows = props.rows, checkboxSelection = props.checkboxSelection, selectionModel = props.selectionModel, onSelectionModelChange = props.onSelectionModelChange, _ = props.rowCount, // rowCount is used in useDataTableRenderer
|
|
142
|
+
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", "paginationModel", "slots", "slotProps"]);
|
|
43
143
|
// lib hooks
|
|
44
|
-
var
|
|
45
|
-
data: data,
|
|
46
|
-
cellOrder: cellOrder,
|
|
47
|
-
headCells: headCells,
|
|
48
|
-
}), renderCellOrder = _g.renderCellOrder, renderHeadCells = _g.renderHeadCells;
|
|
144
|
+
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;
|
|
49
145
|
// state, ref, querystring hooks
|
|
50
146
|
// form hooks
|
|
51
147
|
// query hooks
|
|
52
148
|
// calculated values
|
|
53
149
|
// effects
|
|
54
150
|
// handlers
|
|
55
|
-
return (React.createElement(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
151
|
+
return (React.createElement(Box, null,
|
|
152
|
+
React.createElement(Stack, { direction: "row", sx: {
|
|
153
|
+
pt: 1,
|
|
154
|
+
pb: 1,
|
|
155
|
+
}, justifyContent: "space-between", alignItems: "center" },
|
|
156
|
+
React.createElement(Stack, { direction: "row", spacing: 1 },
|
|
157
|
+
!isAllSelected && (React.createElement(Typography, { level: "body-xs" },
|
|
158
|
+
numberFormatter((selectionModel === null || selectionModel === void 0 ? void 0 : selectionModel.length) || 0),
|
|
159
|
+
" items selected")),
|
|
160
|
+
isAllSelected && !isTotalSelected && (React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
|
|
161
|
+
React.createElement(Typography, { level: "body-xs" },
|
|
162
|
+
"All ",
|
|
163
|
+
numberFormatter((selectionModel === null || selectionModel === void 0 ? void 0 : selectionModel.length) || 0),
|
|
164
|
+
" items on this page are selected."),
|
|
165
|
+
React.createElement(Button, { size: "sm", variant: "plain", onClick: onTotalSelect },
|
|
166
|
+
"Select all ",
|
|
167
|
+
numberFormatter(rows.length),
|
|
168
|
+
" items"))),
|
|
169
|
+
isTotalSelected && (React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
|
|
170
|
+
React.createElement(Typography, { level: "body-xs" },
|
|
171
|
+
"All ",
|
|
172
|
+
numberFormatter(rows.length),
|
|
173
|
+
" items are selected."),
|
|
174
|
+
React.createElement(Button, { size: "sm", variant: "plain", color: "danger", onClick: onTotalSelect }, "Cancel")))),
|
|
175
|
+
Toolbar && React.createElement(Toolbar, __assign({}, (toolbarProps || {})))),
|
|
176
|
+
React.createElement(Sheet, __assign({ variant: "outlined", sx: {
|
|
177
|
+
overflow: "auto",
|
|
178
|
+
width: "100%",
|
|
179
|
+
boxShadow: "sm",
|
|
180
|
+
borderRadius: "sm",
|
|
181
|
+
} }, backgroundProps),
|
|
182
|
+
React.createElement(Table, __assign({ sx: [
|
|
183
|
+
{
|
|
184
|
+
// "--TableCell-headBackground": "transparent",
|
|
185
|
+
"--TableCell-selectedBackground": function (theme) {
|
|
186
|
+
return theme.vars.palette.neutral.plainActiveBg;
|
|
70
187
|
},
|
|
71
|
-
}
|
|
72
|
-
: {},
|
|
73
|
-
{
|
|
74
|
-
"--TableCell-headBackground": "transparent",
|
|
75
|
-
"--TableCell-selectedBackground": function (theme) {
|
|
76
|
-
return theme.vars.palette.success.softBg;
|
|
77
188
|
},
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
189
|
+
] }, innerProps),
|
|
190
|
+
React.createElement("thead", null,
|
|
191
|
+
React.createElement("tr", null,
|
|
192
|
+
checkboxSelection && (React.createElement("th", { style: {
|
|
193
|
+
width: "40px",
|
|
194
|
+
textAlign: "center",
|
|
195
|
+
} },
|
|
196
|
+
React.createElement(RenderCheckbox, __assign({ onChange: onAllCheckboxChange, checked: isAllSelected, indeterminate: (selectionModel || []).length > 0 && !isAllSelected }, checkboxProps)))),
|
|
197
|
+
columns.map(function (column) {
|
|
198
|
+
var _a;
|
|
199
|
+
return (React.createElement("th", { key: column.field, style: {
|
|
200
|
+
width: column.width,
|
|
201
|
+
minWidth: column.minWidth,
|
|
202
|
+
maxWidth: column.maxWidth,
|
|
203
|
+
textAlign: column.type === "number" ? "end" : "start",
|
|
204
|
+
} }, (_a = column.headerName) !== null && _a !== void 0 ? _a : column.field));
|
|
205
|
+
}))),
|
|
206
|
+
React.createElement("tbody", null, dataInPage.map(function (row, rowIndex) {
|
|
207
|
+
var rowId = "".concat(rowIndex + (page - 1) * pageSize);
|
|
208
|
+
return (React.createElement("tr", { key: rowId, role: checkboxSelection ? "checkbox" : undefined, tabIndex: checkboxSelection ? -1 : undefined, onClick: checkboxSelection
|
|
209
|
+
? function (e) { return onCheckboxChange(e, rowId); }
|
|
210
|
+
: undefined, "aria-checked": checkboxSelection ? isSelectedRow(rowId) : undefined, style: checkboxSelection && isSelectedRow(rowId)
|
|
211
|
+
? {
|
|
212
|
+
"--TableCell-dataBackground": "var(--TableCell-selectedBackground)",
|
|
213
|
+
"--TableCell-headBackground": "var(--TableCell-selectedBackground)",
|
|
214
|
+
}
|
|
215
|
+
: {
|
|
216
|
+
"--TableCell-headBackground": "transparent",
|
|
217
|
+
} },
|
|
218
|
+
checkboxSelection && (React.createElement("th", { scope: "row", style: {
|
|
219
|
+
textAlign: "center",
|
|
220
|
+
} },
|
|
221
|
+
React.createElement(RenderCheckbox, __assign({ onChange: function (e) { return onCheckboxChange(e, rowId); }, checked: isSelectedRow(rowId) }, checkboxProps)))),
|
|
222
|
+
columns.map(function (column) { return (React.createElement("td", { key: column.field, style: {
|
|
223
|
+
textAlign: column.type === "number" ? "end" : "start",
|
|
224
|
+
} }, row[column.field])); })));
|
|
225
|
+
})),
|
|
226
|
+
Footer && React.createElement(Footer, null))),
|
|
227
|
+
React.createElement(TablePagination, { paginationModel: { page: page, pageSize: pageSize }, rowCount: rowCount, onPageChange: onPaginationModelChange, onRowsPerPageChange: function () { } })));
|
|
91
228
|
}
|
|
92
229
|
export { DataTable };
|
|
93
230
|
DataTable.displayName = "DataTable";
|
|
@@ -7,5 +7,5 @@ declare const DialogTitle: import("framer-motion").CustomDomComponent<{
|
|
|
7
7
|
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").DialogTitlePropsVariantOverrides> | undefined;
|
|
8
8
|
} & import("@mui/joy").DialogTitleSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
9
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
-
}, "children" | "color" | "
|
|
10
|
+
}, "children" | "color" | "variant" | "sx" | "level" | keyof import("@mui/joy").DialogTitleSlotsAndSlotProps>>;
|
|
11
11
|
export { DialogTitle };
|
|
@@ -3,5 +3,5 @@ declare const Grid: import("framer-motion").CustomDomComponent<import("@mui/syst
|
|
|
3
3
|
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
4
4
|
} & import("@mui/joy/styles/types").SystemProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
5
5
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
6
|
-
},
|
|
6
|
+
}, "sx" | ("p" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | keyof import("@mui/system").GridBaseProps | keyof import("@mui/joy").GridSlotsAndSlotProps>>;
|
|
7
7
|
export { Grid };
|
|
@@ -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;
|
|
@@ -19,7 +19,7 @@ declare const ModalDialog: import("framer-motion").CustomDomComponent<{
|
|
|
19
19
|
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").ModalDialogPropsVariantOverrides> | undefined;
|
|
20
20
|
} & import("@mui/joy").ModalDialogSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
21
21
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
22
|
-
}, "children" | "layout" | "color" | "maxWidth" | "minWidth" | "
|
|
22
|
+
}, "children" | "layout" | "color" | "maxWidth" | "minWidth" | "variant" | "sx" | "size" | "invertedColors" | "orientation" | keyof import("@mui/joy").ModalDialogSlotsAndSlotProps>>;
|
|
23
23
|
export { ModalDialog };
|
|
24
24
|
declare const ModalClose: import("framer-motion").CustomDomComponent<{
|
|
25
25
|
color?: import("@mui/types").OverridableStringUnion<import("@mui/joy").ColorPaletteProp, import("@mui/joy").ModalClosePropsColorOverrides> | undefined;
|
|
@@ -28,7 +28,7 @@ declare const ModalClose: import("framer-motion").CustomDomComponent<{
|
|
|
28
28
|
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").ModalClosePropsVariantOverrides> | undefined;
|
|
29
29
|
} & import("@mui/joy").ModalCloseSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
30
30
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
31
|
-
}, "color" | "
|
|
31
|
+
}, "color" | "variant" | "sx" | "size" | keyof import("@mui/joy").ModalCloseSlotsAndSlotProps>>;
|
|
32
32
|
export { ModalClose };
|
|
33
33
|
declare const ModalOverflow: import("framer-motion").CustomDomComponent<{
|
|
34
34
|
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
@@ -14,7 +14,7 @@ declare const Radio: import("framer-motion").CustomDomComponent<import("@mui/bas
|
|
|
14
14
|
value?: unknown;
|
|
15
15
|
} & import("@mui/joy").RadioSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
16
16
|
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
17
|
-
}, "label" | "
|
|
17
|
+
}, "label" | "color" | "overlay" | "className" | "variant" | "sx" | "size" | "name" | "value" | keyof import("@mui/base").UseSwitchParameters | "checkedIcon" | "disableIcon" | "uncheckedIcon" | keyof import("@mui/joy").RadioSlotsAndSlotProps>>;
|
|
18
18
|
export { Radio };
|
|
19
19
|
declare const RadioGroup: import("framer-motion").CustomDomComponent<{
|
|
20
20
|
className?: string | undefined;
|
|
@@ -32,5 +32,5 @@ declare const RadioGroup: import("framer-motion").CustomDomComponent<{
|
|
|
32
32
|
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").RadioPropsVariantOverrides> | undefined;
|
|
33
33
|
} & import("@mui/joy").RadioGroupSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
34
34
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
35
|
-
}, "
|
|
35
|
+
}, "color" | "overlay" | "defaultValue" | "className" | "onChange" | "variant" | "sx" | "size" | "component" | "name" | "value" | "disableIcon" | "orientation" | keyof import("@mui/joy").RadioGroupSlotsAndSlotProps>>;
|
|
36
36
|
export { RadioGroup };
|
|
@@ -22,5 +22,5 @@ declare const Option: import("framer-motion").CustomDomComponent<{
|
|
|
22
22
|
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
23
23
|
} & import("@mui/joy").OptionSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
24
24
|
ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
|
|
25
|
-
}, "label" | "children" | "color" | "
|
|
25
|
+
}, "label" | "children" | "color" | "variant" | "sx" | "disabled" | "value" | keyof import("@mui/joy").OptionSlotsAndSlotProps>>;
|
|
26
26
|
export { Option };
|
|
@@ -7,5 +7,5 @@ declare const Sheet: import("framer-motion").CustomDomComponent<{
|
|
|
7
7
|
variant?: import("@mui/types").OverridableStringUnion<import("@mui/joy").VariantProp, import("@mui/joy").SheetPropsVariantOverrides> | undefined;
|
|
8
8
|
} & import("@mui/joy").SheetSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
9
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
-
}, "children" | "color" | "
|
|
10
|
+
}, "children" | "color" | "variant" | "sx" | "invertedColors" | keyof import("@mui/joy").SheetSlotsAndSlotProps>>;
|
|
11
11
|
export { Sheet };
|
|
@@ -8,5 +8,5 @@ declare const Stack: import("framer-motion").CustomDomComponent<{
|
|
|
8
8
|
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
9
9
|
} & import("@mui/joy").StackSlotsAndSlotProps & import("@mui/joy/styles/types").SystemProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
10
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
11
|
-
}, "children" | "direction" |
|
|
11
|
+
}, "children" | "direction" | "sx" | ("p" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "spacing" | "divider" | "useFlexGap" | keyof import("@mui/joy").StackSlotsAndSlotProps>>;
|
|
12
12
|
export { Stack };
|