@ceed/cds 0.0.5 → 0.0.32
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/Button/Button.d.ts +22 -5
- package/dist/components/Button/Button.js +4 -4
- package/dist/components/Container/Container.d.ts +5 -0
- package/dist/components/Container/Container.js +51 -0
- package/dist/components/Container/index.d.ts +3 -0
- package/dist/components/Container/index.js +3 -0
- package/dist/components/DataTable/DataTable.d.ts +56 -0
- package/dist/components/DataTable/DataTable.js +268 -0
- package/dist/components/DataTable/index.d.ts +3 -0
- package/dist/components/DataTable/index.js +3 -0
- package/dist/components/DialogActions/DialogActions.d.ts +1 -1
- 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/DialogTitle/DialogTitle.d.ts +1 -1
- package/dist/components/Grid/Grid.d.ts +1 -1
- package/dist/components/InsetDrawer/InsetDrawer.d.ts +8 -0
- package/dist/components/InsetDrawer/InsetDrawer.js +45 -0
- package/dist/components/InsetDrawer/index.d.ts +3 -0
- package/dist/components/InsetDrawer/index.js +3 -0
- package/dist/components/Modal/Modal.d.ts +13 -5
- package/dist/components/Modal/Modal.js +42 -0
- package/dist/components/Radio/Radio.d.ts +2 -2
- package/dist/components/RadioList/RadioList.d.ts +12 -0
- package/dist/components/RadioList/RadioList.js +38 -0
- package/dist/components/RadioList/index.d.ts +3 -0
- package/dist/components/RadioList/index.js +3 -0
- package/dist/components/Select/Select.d.ts +2 -2
- package/dist/components/Sheet/Sheet.d.ts +1 -1
- package/dist/components/Stack/Stack.d.ts +1 -1
- package/dist/components/Table/Table.d.ts +56 -2
- package/dist/components/Table/Table.js +64 -3
- package/dist/components/Tabs/Tabs.d.ts +53 -0
- package/dist/components/Tabs/Tabs.js +18 -0
- package/dist/components/Tabs/index.d.ts +3 -0
- package/dist/components/Tabs/index.js +3 -0
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.js +45 -4
- package/dist/components/index.d.ts +12 -5
- package/dist/components/index.js +12 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/framer/index.js +25044 -15916
- package/package.json +4 -6
|
@@ -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,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<HTMLElement>>;
|
|
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, ref) {
|
|
17
17
|
// prop destruction
|
|
18
18
|
// lib hooks
|
|
19
19
|
// state, ref, querystring hooks
|
|
@@ -22,7 +22,7 @@ var Button = function (props) {
|
|
|
22
22
|
// calculated values
|
|
23
23
|
// effects
|
|
24
24
|
// handlers
|
|
25
|
-
return (React.createElement(MotionButton, __assign({}, props)));
|
|
26
|
-
};
|
|
25
|
+
return (React.createElement(MotionButton, __assign({ ref: ref }, props)));
|
|
26
|
+
});
|
|
27
27
|
export { Button };
|
|
28
28
|
Button.displayName = "Button";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const Container: React.ForwardRefExoticComponent<Omit<import("@mui/system").MUIStyledCommonProps<import("@mui/joy").Theme> & {
|
|
3
|
+
maxWidth?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
4
|
+
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export { Container };
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
import { styled } from "@mui/joy";
|
|
13
|
+
import React, { forwardRef } from "react";
|
|
14
|
+
var ContainerRoot = styled("div", {
|
|
15
|
+
name: "Container",
|
|
16
|
+
slot: "root",
|
|
17
|
+
shouldForwardProp: function (prop) { return prop !== "maxWidth"; },
|
|
18
|
+
})(function (_a) {
|
|
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
|
+
},
|
|
25
|
+
_b))), (maxWidth === "md" && (_c = {},
|
|
26
|
+
_c[theme.breakpoints.up("sm")] = {
|
|
27
|
+
maxWidth: theme.breakpoints.values.md,
|
|
28
|
+
},
|
|
29
|
+
_c))), (maxWidth === "lg" && (_d = {},
|
|
30
|
+
_d[theme.breakpoints.up("md")] = {
|
|
31
|
+
maxWidth: theme.breakpoints.values.lg,
|
|
32
|
+
},
|
|
33
|
+
_d))), (maxWidth === "xl" && (_e = {},
|
|
34
|
+
_e[theme.breakpoints.up("lg")] = {
|
|
35
|
+
maxWidth: theme.breakpoints.values.xl,
|
|
36
|
+
},
|
|
37
|
+
_e))));
|
|
38
|
+
});
|
|
39
|
+
var Container = forwardRef(function Container(props, ref) {
|
|
40
|
+
// prop destruction
|
|
41
|
+
// lib hooks
|
|
42
|
+
// state, ref, querystring hooks
|
|
43
|
+
// form hooks
|
|
44
|
+
// query hooks
|
|
45
|
+
// calculated values
|
|
46
|
+
// effects
|
|
47
|
+
// handlers
|
|
48
|
+
return React.createElement(ContainerRoot, __assign({ ref: ref }, props));
|
|
49
|
+
});
|
|
50
|
+
export { Container };
|
|
51
|
+
Container.displayName = "Container";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { ComponentProps } from "react";
|
|
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
|
+
};
|
|
12
|
+
type DataTableProps<T extends Record<string, unknown>> = {
|
|
13
|
+
rows: T[];
|
|
14
|
+
checkboxSelection?: boolean;
|
|
15
|
+
columns: Column<T>[];
|
|
16
|
+
/**
|
|
17
|
+
* 체크박스가 있는 경우, 체크박스를 클릭했을 때 선택된 row의 index를 지정한다.
|
|
18
|
+
*/
|
|
19
|
+
selectionModel?: string[];
|
|
20
|
+
onSelectionModelChange?: (newSelectionModel: string[]) => void;
|
|
21
|
+
paginationModel?: {
|
|
22
|
+
page: number;
|
|
23
|
+
pageSize: number;
|
|
24
|
+
};
|
|
25
|
+
onPaginationModelChange?: (model: {
|
|
26
|
+
page: number;
|
|
27
|
+
pageSize: number;
|
|
28
|
+
}) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Rows의 총 갯수를 직접 지정 할 수 있다.
|
|
31
|
+
* 기본적으로는 rows.length를 사용하지만, 이 값을 지정하면 rows.length를 사용하지 않는다.
|
|
32
|
+
*/
|
|
33
|
+
rowCount?: number;
|
|
34
|
+
slots?: {
|
|
35
|
+
checkbox?: React.ElementType;
|
|
36
|
+
toolbar?: React.ElementType;
|
|
37
|
+
footer?: React.ElementType;
|
|
38
|
+
};
|
|
39
|
+
slotProps?: {
|
|
40
|
+
checkbox?: Partial<{
|
|
41
|
+
checked: boolean;
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}>;
|
|
44
|
+
toolbar?: Partial<{
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
}>;
|
|
47
|
+
background?: Partial<{
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
} & ComponentProps<typeof Table>;
|
|
52
|
+
declare function DataTable<T extends Record<string, unknown>>(props: DataTableProps<T>): React.JSX.Element;
|
|
53
|
+
declare namespace DataTable {
|
|
54
|
+
var displayName: string;
|
|
55
|
+
}
|
|
56
|
+
export { DataTable };
|
|
@@ -0,0 +1,268 @@
|
|
|
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
|
+
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, useRef, useState, } from "react";
|
|
33
|
+
import Sheet from "../Sheet";
|
|
34
|
+
import { Table } from "../Table";
|
|
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
|
+
}
|
|
74
|
+
var Resizer = function (ref) { return (React.createElement(Box, { sx: {
|
|
75
|
+
position: "absolute",
|
|
76
|
+
top: 0,
|
|
77
|
+
right: 0,
|
|
78
|
+
bottom: 0,
|
|
79
|
+
width: "4px",
|
|
80
|
+
cursor: "col-resize",
|
|
81
|
+
}, onMouseDown: function (e) {
|
|
82
|
+
var _a;
|
|
83
|
+
var initialX = e.clientX;
|
|
84
|
+
var initialWidth = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
|
|
85
|
+
var onMouseMove = function (e) {
|
|
86
|
+
if (initialWidth && initialX) {
|
|
87
|
+
ref.current.style.width = "".concat(initialWidth + (e.clientX - initialX), "px");
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var onMouseUp = function () {
|
|
91
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
92
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
93
|
+
};
|
|
94
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
95
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
96
|
+
} })); };
|
|
97
|
+
var HeadCell = function (props) {
|
|
98
|
+
var _a, _b, _c;
|
|
99
|
+
var ref = useRef(null);
|
|
100
|
+
var style = {
|
|
101
|
+
width: props.width,
|
|
102
|
+
minWidth: (_a = props.minWidth) !== null && _a !== void 0 ? _a : "50px",
|
|
103
|
+
maxWidth: props.maxWidth,
|
|
104
|
+
textAlign: props.type === "number" ? "end" : "start",
|
|
105
|
+
position: props.stickyHeader ? undefined : "relative",
|
|
106
|
+
};
|
|
107
|
+
var resizer = ((_b = props.resizable) !== null && _b !== void 0 ? _b : true) ? Resizer(ref) : null;
|
|
108
|
+
return (React.createElement("th", { ref: ref, key: props.field, style: style }, (_c = props.headerName) !== null && _c !== void 0 ? _c : props.field,
|
|
109
|
+
resizer));
|
|
110
|
+
};
|
|
111
|
+
function useDataTableRenderer(_a) {
|
|
112
|
+
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;
|
|
113
|
+
var _c = useState((paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.page) || 1), page = _c[0], setPage = _c[1];
|
|
114
|
+
var pageSize = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSize) || 20;
|
|
115
|
+
var selectedModelSet = useMemo(function () { return new Set(selectionModel); }, [selectionModel]);
|
|
116
|
+
var dataInPage = useMemo(function () { return rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize); }, [rows, page, pageSize]);
|
|
117
|
+
var isAllSelected = useMemo(function () {
|
|
118
|
+
return dataInPage.length > 0 &&
|
|
119
|
+
dataInPage.every(function (_, i) {
|
|
120
|
+
return selectedModelSet.has("".concat(i + (page - 1) * pageSize));
|
|
121
|
+
});
|
|
122
|
+
}, [dataInPage, selectedModelSet, page, pageSize]);
|
|
123
|
+
var rowCount = totalRowsProp || rows.length;
|
|
124
|
+
var isTotalSelected = useMemo(function () { return rowCount > 0 && selectionModel.length === rowCount; }, [selectionModel, rowCount]);
|
|
125
|
+
var handlePageChange = useCallback(function (newPage) {
|
|
126
|
+
setPage(newPage);
|
|
127
|
+
onPaginationModelChange === null || onPaginationModelChange === void 0 ? void 0 : onPaginationModelChange({ page: newPage, pageSize: pageSize });
|
|
128
|
+
}, [onPaginationModelChange]);
|
|
129
|
+
useEffect(function () {
|
|
130
|
+
handlePageChange(1);
|
|
131
|
+
}, [rowCount]);
|
|
132
|
+
useEffect(function () {
|
|
133
|
+
if (page > Math.ceil(rowCount / pageSize)) {
|
|
134
|
+
handlePageChange(Math.ceil(rowCount / pageSize));
|
|
135
|
+
}
|
|
136
|
+
}, [rowCount, pageSize]);
|
|
137
|
+
useEffect(function () {
|
|
138
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange([]);
|
|
139
|
+
}, [page]);
|
|
140
|
+
return {
|
|
141
|
+
rowCount: rowCount,
|
|
142
|
+
page: page,
|
|
143
|
+
pageSize: pageSize,
|
|
144
|
+
onPaginationModelChange: handlePageChange,
|
|
145
|
+
HeadCell: HeadCell,
|
|
146
|
+
// HeadCell: useCallback(
|
|
147
|
+
// (column: Column<any>) => {
|
|
148
|
+
// const ref = useRef<HTMLTableCellElement>(null);
|
|
149
|
+
// const style = {
|
|
150
|
+
// width: column.width,
|
|
151
|
+
// minWidth: column.minWidth ?? "50px",
|
|
152
|
+
// maxWidth: column.maxWidth,
|
|
153
|
+
// textAlign: column.type === "number" ? "end" : "start",
|
|
154
|
+
// position: stickyHeader ? undefined : "relative",
|
|
155
|
+
// } as React.CSSProperties;
|
|
156
|
+
// const resizer = column.resizable ?? true ? Resizer(ref) : null;
|
|
157
|
+
// return (
|
|
158
|
+
// <th ref={ref} key={column.field as string} style={style}>
|
|
159
|
+
// {column.headerName ?? (column.field as string)}
|
|
160
|
+
// {resizer}
|
|
161
|
+
// </th>
|
|
162
|
+
// );
|
|
163
|
+
// },
|
|
164
|
+
// [stickyHeader, columns]
|
|
165
|
+
// ),
|
|
166
|
+
dataInPage: dataInPage,
|
|
167
|
+
isAllSelected: isAllSelected, // all rows are selected on this page
|
|
168
|
+
isTotalSelected: isTotalSelected,
|
|
169
|
+
isSelectedRow: useCallback(function (model) { return selectedModelSet.has(model); }, [selectedModelSet]),
|
|
170
|
+
onAllCheckboxChange: useCallback(function () {
|
|
171
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(isAllSelected
|
|
172
|
+
? []
|
|
173
|
+
: dataInPage.map(function (_, i) { return "".concat(i + (page - 1) * pageSize); }));
|
|
174
|
+
}, [isAllSelected, dataInPage, onSelectionModelChange]),
|
|
175
|
+
onCheckboxChange: useCallback(function (event, selectedModel) {
|
|
176
|
+
if (selectedModelSet.has(selectedModel)) {
|
|
177
|
+
var newSelectionModel = selectionModel.filter(function (model) { return model !== selectedModel; });
|
|
178
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
var newSelectionModel = __spreadArray(__spreadArray([], selectionModel, true), [selectedModel], false);
|
|
182
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel);
|
|
183
|
+
}
|
|
184
|
+
}, [selectionModel, onSelectionModelChange]),
|
|
185
|
+
columns: useMemo(function () {
|
|
186
|
+
return columns ||
|
|
187
|
+
// fallback
|
|
188
|
+
Object.keys(rows[0] || {}).map(function (key) { return ({
|
|
189
|
+
field: key,
|
|
190
|
+
}); });
|
|
191
|
+
}, [rows, columns]),
|
|
192
|
+
onTotalSelect: useCallback(function () {
|
|
193
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(isTotalSelected ? [] : rows.map(function (_, i) { return "".concat(i); }));
|
|
194
|
+
}, [isTotalSelected, rows, onSelectionModelChange]),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function DataTable(props) {
|
|
198
|
+
// prop destruction
|
|
199
|
+
var rows = props.rows, checkboxSelection = props.checkboxSelection, selectionModel = props.selectionModel, onSelectionModelChange = props.onSelectionModelChange, _ = props.rowCount, // rowCount is used in useDataTableRenderer
|
|
200
|
+
__ = props.columns, // columns is used in useDataTableRenderer
|
|
201
|
+
___ = props.onPaginationModelChange, // onPaginationModelChange is used in useDataTableRenderer
|
|
202
|
+
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"]);
|
|
203
|
+
// lib hooks
|
|
204
|
+
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, HeadCell = _h.HeadCell;
|
|
205
|
+
// state, ref, querystring hooks
|
|
206
|
+
// form hooks
|
|
207
|
+
// query hooks
|
|
208
|
+
// calculated values
|
|
209
|
+
// effects
|
|
210
|
+
// handlers
|
|
211
|
+
return (React.createElement(Box, null,
|
|
212
|
+
React.createElement(Stack, { direction: "row", sx: {
|
|
213
|
+
pt: 1,
|
|
214
|
+
pb: 1,
|
|
215
|
+
}, justifyContent: "space-between", alignItems: "center" },
|
|
216
|
+
React.createElement(Stack, { direction: "row", spacing: 1 },
|
|
217
|
+
!isAllSelected && (React.createElement(Typography, { level: "body-xs" },
|
|
218
|
+
numberFormatter((selectionModel === null || selectionModel === void 0 ? void 0 : selectionModel.length) || 0),
|
|
219
|
+
" items selected")),
|
|
220
|
+
isAllSelected && !isTotalSelected && (React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
|
|
221
|
+
React.createElement(Typography, { level: "body-xs" },
|
|
222
|
+
"All ",
|
|
223
|
+
numberFormatter((selectionModel === null || selectionModel === void 0 ? void 0 : selectionModel.length) || 0),
|
|
224
|
+
" items on this page are selected."),
|
|
225
|
+
React.createElement(Button, { size: "sm", variant: "plain", onClick: onTotalSelect },
|
|
226
|
+
"Select all ",
|
|
227
|
+
numberFormatter(rows.length),
|
|
228
|
+
" items"))),
|
|
229
|
+
isTotalSelected && (React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
|
|
230
|
+
React.createElement(Typography, { level: "body-xs" },
|
|
231
|
+
"All ",
|
|
232
|
+
numberFormatter(rows.length),
|
|
233
|
+
" items are selected."),
|
|
234
|
+
React.createElement(Button, { size: "sm", variant: "plain", color: "danger", onClick: onTotalSelect }, "Cancel")))),
|
|
235
|
+
Toolbar && React.createElement(Toolbar, __assign({}, (toolbarProps || {})))),
|
|
236
|
+
React.createElement(Sheet, __assign({ variant: "outlined", sx: {
|
|
237
|
+
overflow: "auto",
|
|
238
|
+
width: "100%",
|
|
239
|
+
boxShadow: "sm",
|
|
240
|
+
borderRadius: "sm",
|
|
241
|
+
} }, backgroundProps),
|
|
242
|
+
React.createElement(Table, __assign({}, innerProps),
|
|
243
|
+
React.createElement("thead", null,
|
|
244
|
+
React.createElement("tr", null,
|
|
245
|
+
checkboxSelection && (React.createElement("th", { style: {
|
|
246
|
+
width: "40px",
|
|
247
|
+
textAlign: "center",
|
|
248
|
+
} },
|
|
249
|
+
React.createElement(RenderCheckbox, __assign({ onChange: onAllCheckboxChange, checked: isAllSelected, indeterminate: (selectionModel || []).length > 0 && !isAllSelected }, checkboxProps)))),
|
|
250
|
+
columns.map(function (c) { return (React.createElement(HeadCell, __assign({ key: c.field, stickyHeader: props.stickyHeader }, c))); }))),
|
|
251
|
+
React.createElement("tbody", null, dataInPage.map(function (row, rowIndex) {
|
|
252
|
+
var rowId = "".concat(rowIndex + (page - 1) * pageSize);
|
|
253
|
+
return (React.createElement("tr", { key: rowId, role: checkboxSelection ? "checkbox" : undefined, tabIndex: checkboxSelection ? -1 : undefined, onClick: checkboxSelection
|
|
254
|
+
? function (e) { return onCheckboxChange(e, rowId); }
|
|
255
|
+
: undefined, "aria-checked": checkboxSelection ? isSelectedRow(rowId) : undefined },
|
|
256
|
+
checkboxSelection && (React.createElement("th", { scope: "row", style: {
|
|
257
|
+
textAlign: "center",
|
|
258
|
+
} },
|
|
259
|
+
React.createElement(RenderCheckbox, __assign({ onChange: function (e) { return onCheckboxChange(e, rowId); }, checked: isSelectedRow(rowId) }, checkboxProps)))),
|
|
260
|
+
columns.map(function (column) { return (React.createElement("td", { key: column.field, style: {
|
|
261
|
+
textAlign: column.type === "number" ? "end" : "start",
|
|
262
|
+
} }, row[column.field])); })));
|
|
263
|
+
})),
|
|
264
|
+
Footer && React.createElement(Footer, null))),
|
|
265
|
+
React.createElement(TablePagination, { paginationModel: { page: page, pageSize: pageSize }, rowCount: rowCount, onPageChange: onPaginationModelChange, onRowsPerPageChange: function () { } })));
|
|
266
|
+
}
|
|
267
|
+
export { DataTable };
|
|
268
|
+
DataTable.displayName = "DataTable";
|
|
@@ -6,5 +6,5 @@ declare const DialogActions: import("framer-motion").CustomDomComponent<{
|
|
|
6
6
|
sx?: import("@mui/joy/styles/types").SxProps | undefined;
|
|
7
7
|
} & import("@mui/joy").DialogActionsSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
8
8
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
9
|
-
}, "children" | "sx" | "
|
|
9
|
+
}, "children" | "sx" | "orientation" | "buttonFlex" | keyof import("@mui/joy").DialogActionsSlotsAndSlotProps>>;
|
|
10
10
|
export { DialogActions };
|
|
@@ -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 };
|