@ceed/ads 0.0.68 → 0.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DataTable/DataTable.d.ts +8 -3
- package/dist/index.js +11 -8
- package/framer/index.js +9 -8
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { Table } from "../Table";
|
|
3
|
-
type
|
|
3
|
+
export type ColumnDef<T extends Record<string, V>, V = unknown> = {
|
|
4
4
|
type?: "number" | "string";
|
|
5
5
|
field: keyof T;
|
|
6
6
|
headerName?: string;
|
|
@@ -14,10 +14,10 @@ type Column<T extends Record<string, V>, V = unknown> = {
|
|
|
14
14
|
id: string;
|
|
15
15
|
}) => ReactNode;
|
|
16
16
|
};
|
|
17
|
-
type DataTableProps<T extends Record<string, unknown>> = {
|
|
17
|
+
export type DataTableProps<T extends Record<string, unknown>> = {
|
|
18
18
|
rows: T[];
|
|
19
19
|
checkboxSelection?: boolean;
|
|
20
|
-
columns:
|
|
20
|
+
columns: ColumnDef<T>[];
|
|
21
21
|
/**
|
|
22
22
|
* 체크박스가 있는 경우, 체크박스를 클릭했을 때 선택된 row의 index를 지정한다.
|
|
23
23
|
*/
|
|
@@ -45,6 +45,11 @@ type DataTableProps<T extends Record<string, unknown>> = {
|
|
|
45
45
|
rowCount?: number;
|
|
46
46
|
loading?: boolean;
|
|
47
47
|
getId?: (row: T) => string;
|
|
48
|
+
/**
|
|
49
|
+
* 기본적으로 Uncontrolled로 작동하지만, Controlled로 작동하게 하고 싶을 때 사용한다.
|
|
50
|
+
* 이 값이 true이면, 현재 페이지 이외에도 존재하는 모든 데이터가 선택된것으로 간주하고 동작한다.
|
|
51
|
+
*/
|
|
52
|
+
isTotalSelected?: boolean;
|
|
48
53
|
slots?: {
|
|
49
54
|
checkbox?: React.ElementType;
|
|
50
55
|
toolbar?: React.ElementType;
|
package/dist/index.js
CHANGED
|
@@ -1044,6 +1044,8 @@ import React12, {
|
|
|
1044
1044
|
} from "react";
|
|
1045
1045
|
import { styled as styled3 } from "@mui/joy/styles";
|
|
1046
1046
|
import LinearProgress from "@mui/joy/LinearProgress";
|
|
1047
|
+
import PreviousIcon from "@mui/icons-material/esm/ChevronLeft.js";
|
|
1048
|
+
import NextIcon from "@mui/icons-material/esm/ChevronRight.js";
|
|
1047
1049
|
|
|
1048
1050
|
// src/components/Sheet/Sheet.tsx
|
|
1049
1051
|
import { Sheet as JoySheet } from "@mui/joy";
|
|
@@ -1184,7 +1186,7 @@ function TablePagination(props) {
|
|
|
1184
1186
|
alignItems: "center"
|
|
1185
1187
|
},
|
|
1186
1188
|
/* @__PURE__ */ React12.createElement(Stack_default, { direction: "row", spacing: 0.5, alignItems: "center" }, /* @__PURE__ */ React12.createElement(
|
|
1187
|
-
|
|
1189
|
+
IconButton_default,
|
|
1188
1190
|
{
|
|
1189
1191
|
size: "sm",
|
|
1190
1192
|
variant: "plain",
|
|
@@ -1193,7 +1195,7 @@ function TablePagination(props) {
|
|
|
1193
1195
|
disabled: page === firstPage,
|
|
1194
1196
|
"aria-label": "Previous page"
|
|
1195
1197
|
},
|
|
1196
|
-
|
|
1198
|
+
/* @__PURE__ */ React12.createElement(PreviousIcon, null)
|
|
1197
1199
|
), page !== firstPage && /* @__PURE__ */ React12.createElement(
|
|
1198
1200
|
Button_default,
|
|
1199
1201
|
{
|
|
@@ -1251,7 +1253,7 @@ function TablePagination(props) {
|
|
|
1251
1253
|
},
|
|
1252
1254
|
lastPage
|
|
1253
1255
|
), /* @__PURE__ */ React12.createElement(
|
|
1254
|
-
|
|
1256
|
+
IconButton_default,
|
|
1255
1257
|
{
|
|
1256
1258
|
size: "sm",
|
|
1257
1259
|
variant: "plain",
|
|
@@ -1260,7 +1262,7 @@ function TablePagination(props) {
|
|
|
1260
1262
|
disabled: page === lastPage,
|
|
1261
1263
|
"aria-label": "Next page"
|
|
1262
1264
|
},
|
|
1263
|
-
|
|
1265
|
+
/* @__PURE__ */ React12.createElement(NextIcon, null)
|
|
1264
1266
|
))
|
|
1265
1267
|
);
|
|
1266
1268
|
}
|
|
@@ -1313,7 +1315,8 @@ function useDataTableRenderer({
|
|
|
1313
1315
|
onPaginationModelChange,
|
|
1314
1316
|
selectionModel = [],
|
|
1315
1317
|
onSelectionModelChange,
|
|
1316
|
-
getId: _getId
|
|
1318
|
+
getId: _getId,
|
|
1319
|
+
isTotalSelected: _isTotalSelected
|
|
1317
1320
|
}) {
|
|
1318
1321
|
const [page, setPage] = useState4(paginationModel?.page || 1);
|
|
1319
1322
|
const pageSize = paginationModel?.pageSize || 20;
|
|
@@ -1335,8 +1338,8 @@ function useDataTableRenderer({
|
|
|
1335
1338
|
);
|
|
1336
1339
|
const rowCount = totalRowsProp || rows.length;
|
|
1337
1340
|
const isTotalSelected = useMemo3(
|
|
1338
|
-
() => rowCount > 0 && selectionModel.length === rowCount,
|
|
1339
|
-
[selectionModel, rowCount]
|
|
1341
|
+
() => _isTotalSelected ?? (rowCount > 0 && selectionModel.length === rowCount),
|
|
1342
|
+
[_isTotalSelected, selectionModel, rowCount]
|
|
1340
1343
|
);
|
|
1341
1344
|
const handlePageChange = useCallback3(
|
|
1342
1345
|
(newPage) => {
|
|
@@ -1398,7 +1401,7 @@ function useDataTableRenderer({
|
|
|
1398
1401
|
onTotalSelect: useCallback3(() => {
|
|
1399
1402
|
onSelectionModelChange?.(
|
|
1400
1403
|
isTotalSelected ? [] : rows.map(getId),
|
|
1401
|
-
isTotalSelected
|
|
1404
|
+
!isTotalSelected
|
|
1402
1405
|
);
|
|
1403
1406
|
}, [isTotalSelected, rows, onSelectionModelChange])
|
|
1404
1407
|
};
|
package/framer/index.js
CHANGED
|
@@ -38043,7 +38043,7 @@ function TablePagination(props) {
|
|
|
38043
38043
|
alignItems: "center",
|
|
38044
38044
|
children: /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 0.5, alignItems: "center", children: [
|
|
38045
38045
|
/* @__PURE__ */ jsx2(
|
|
38046
|
-
|
|
38046
|
+
IconButton_default2,
|
|
38047
38047
|
{
|
|
38048
38048
|
size: "sm",
|
|
38049
38049
|
variant: "plain",
|
|
@@ -38051,7 +38051,7 @@ function TablePagination(props) {
|
|
|
38051
38051
|
onClick: () => onPageChange(page - 1),
|
|
38052
38052
|
disabled: page === firstPage,
|
|
38053
38053
|
"aria-label": "Previous page",
|
|
38054
|
-
children:
|
|
38054
|
+
children: /* @__PURE__ */ jsx2(ChevronLeft_default, {})
|
|
38055
38055
|
}
|
|
38056
38056
|
),
|
|
38057
38057
|
page !== firstPage && /* @__PURE__ */ jsx2(
|
|
@@ -38118,7 +38118,7 @@ function TablePagination(props) {
|
|
|
38118
38118
|
}
|
|
38119
38119
|
),
|
|
38120
38120
|
/* @__PURE__ */ jsx2(
|
|
38121
|
-
|
|
38121
|
+
IconButton_default2,
|
|
38122
38122
|
{
|
|
38123
38123
|
size: "sm",
|
|
38124
38124
|
variant: "plain",
|
|
@@ -38126,7 +38126,7 @@ function TablePagination(props) {
|
|
|
38126
38126
|
onClick: () => onPageChange(page + 1),
|
|
38127
38127
|
disabled: page === lastPage,
|
|
38128
38128
|
"aria-label": "Next page",
|
|
38129
|
-
children:
|
|
38129
|
+
children: /* @__PURE__ */ jsx2(ChevronRight_default, {})
|
|
38130
38130
|
}
|
|
38131
38131
|
)
|
|
38132
38132
|
] })
|
|
@@ -38187,7 +38187,8 @@ function useDataTableRenderer({
|
|
|
38187
38187
|
onPaginationModelChange,
|
|
38188
38188
|
selectionModel = [],
|
|
38189
38189
|
onSelectionModelChange,
|
|
38190
|
-
getId: _getId
|
|
38190
|
+
getId: _getId,
|
|
38191
|
+
isTotalSelected: _isTotalSelected
|
|
38191
38192
|
}) {
|
|
38192
38193
|
const [page, setPage] = useState25((paginationModel == null ? void 0 : paginationModel.page) || 1);
|
|
38193
38194
|
const pageSize2 = (paginationModel == null ? void 0 : paginationModel.pageSize) || 20;
|
|
@@ -38212,8 +38213,8 @@ function useDataTableRenderer({
|
|
|
38212
38213
|
);
|
|
38213
38214
|
const rowCount = totalRowsProp || rows.length;
|
|
38214
38215
|
const isTotalSelected = useMemo35(
|
|
38215
|
-
() => rowCount > 0 && selectionModel.length === rowCount,
|
|
38216
|
-
[selectionModel, rowCount]
|
|
38216
|
+
() => _isTotalSelected != null ? _isTotalSelected : rowCount > 0 && selectionModel.length === rowCount,
|
|
38217
|
+
[_isTotalSelected, selectionModel, rowCount]
|
|
38217
38218
|
);
|
|
38218
38219
|
const handlePageChange = useCallback26(
|
|
38219
38220
|
(newPage) => {
|
|
@@ -38275,7 +38276,7 @@ function useDataTableRenderer({
|
|
|
38275
38276
|
onTotalSelect: useCallback26(() => {
|
|
38276
38277
|
onSelectionModelChange == null ? void 0 : onSelectionModelChange(
|
|
38277
38278
|
isTotalSelected ? [] : rows.map(getId),
|
|
38278
|
-
isTotalSelected
|
|
38279
|
+
!isTotalSelected
|
|
38279
38280
|
);
|
|
38280
38281
|
}, [isTotalSelected, rows, onSelectionModelChange])
|
|
38281
38282
|
};
|