@tidbcloud/uikit 2.0.0-beta.94 → 2.0.0-beta.96
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/CHANGELOG.md +22 -0
- package/dist/biz/PageShell/index.cjs +2 -1
- package/dist/biz/PageShell/index.d.cts +4 -1
- package/dist/biz/PageShell/index.d.ts +4 -1
- package/dist/biz/PageShell/index.js +2 -1
- package/dist/biz/Table/ProTable/ProTable.cjs +9 -4
- package/dist/biz/Table/ProTable/ProTable.js +11 -6
- package/dist/biz/Table/ProTable/helpers.cjs +14 -8
- package/dist/biz/Table/ProTable/helpers.js +14 -8
- package/dist/biz/Table/ProTable/types.d.cts +1 -1
- package/dist/biz/Table/ProTable/types.d.ts +1 -1
- package/dist/biz/Table/TablePagination.cjs +92 -27
- package/dist/biz/Table/TablePagination.d.cts +28 -3
- package/dist/biz/Table/TablePagination.d.ts +28 -3
- package/dist/biz/Table/TablePagination.js +92 -27
- package/dist/biz/Tree/index.cjs +1 -1
- package/dist/biz/Tree/index.js +1 -1
- package/dist/theme/colors.cjs +10 -0
- package/dist/theme/colors.dark.cjs +10 -0
- package/dist/theme/colors.dark.js +10 -0
- package/dist/theme/colors.js +10 -0
- package/dist/theme/theme.cjs +11 -1
- package/dist/theme/theme.js +11 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @tidbcloud/uikit
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.96
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(Select): update Select component styles to include check icon and… ([#358](https://github.com/tidbcloud/tidbcloud-uikit/pull/358))
|
|
8
|
+
- fix(Tree): update background color from blue to carbon for indeterminate checkbox for improved theme consistency ([#357](https://github.com/tidbcloud/tidbcloud-uikit/pull/357))
|
|
9
|
+
- fix(PageShell): update PageHeader styles to set height instead of margin ([#356](https://github.com/tidbcloud/tidbcloud-uikit/pull/356))
|
|
10
|
+
- fix(ProTable): resizing cursor missing ([#355](https://github.com/tidbcloud/tidbcloud-uikit/pull/355))
|
|
11
|
+
|
|
12
|
+
## 2.0.0-beta.95
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- feat(ProTable): update version
|
|
17
|
+
- fix(ProTable): invalid use hook
|
|
18
|
+
- feat(ProTable): update version
|
|
19
|
+
- feat(ProTable): enable scrollbar
|
|
20
|
+
- fix(ProTable): typo
|
|
21
|
+
- feat(ProTable): update storybook
|
|
22
|
+
- refactor(ProTable): add new pagination
|
|
23
|
+
- feat: add protablepagination
|
|
24
|
+
|
|
3
25
|
## 2.0.0-beta.94
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -28,7 +28,7 @@ const PageHeader = ({ sticky, leftSection, rightSection, children, ...restProps
|
|
|
28
28
|
{
|
|
29
29
|
paddingLeft: 24,
|
|
30
30
|
paddingRight: 24,
|
|
31
|
-
|
|
31
|
+
height: 56
|
|
32
32
|
},
|
|
33
33
|
sticky ? (theme) => ({
|
|
34
34
|
position: "sticky",
|
|
@@ -116,4 +116,5 @@ const PageShell = ({
|
|
|
116
116
|
}
|
|
117
117
|
return page;
|
|
118
118
|
};
|
|
119
|
+
PageShell.Header = PageHeader;
|
|
119
120
|
exports.PageShell = PageShell;
|
|
@@ -79,4 +79,7 @@ export interface PageShellProps {
|
|
|
79
79
|
};
|
|
80
80
|
children?: ReactNode;
|
|
81
81
|
}
|
|
82
|
-
export declare const PageShell:
|
|
82
|
+
export declare const PageShell: {
|
|
83
|
+
({ className, headerClassName, bodyClassName, headerSticky, headerRightSection, headerBack, title, wrapped, wrapperProps, headerProps: { withBack, onBackClick, ...headerProps }, bodyProps, children }: PageShellProps): import("react/jsx-runtime.js").JSX.Element;
|
|
84
|
+
Header: ({ sticky, leftSection, rightSection, children, ...restProps }: PageHeaderProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
85
|
+
};
|
|
@@ -79,4 +79,7 @@ export interface PageShellProps {
|
|
|
79
79
|
};
|
|
80
80
|
children?: ReactNode;
|
|
81
81
|
}
|
|
82
|
-
export declare const PageShell:
|
|
82
|
+
export declare const PageShell: {
|
|
83
|
+
({ className, headerClassName, bodyClassName, headerSticky, headerRightSection, headerBack, title, wrapped, wrapperProps, headerProps: { withBack, onBackClick, ...headerProps }, bodyProps, children }: PageShellProps): import("react/jsx-runtime.js").JSX.Element;
|
|
84
|
+
Header: ({ sticky, leftSection, rightSection, children, ...restProps }: PageHeaderProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
85
|
+
};
|
|
@@ -26,7 +26,7 @@ const PageHeader = ({ sticky, leftSection, rightSection, children, ...restProps
|
|
|
26
26
|
{
|
|
27
27
|
paddingLeft: 24,
|
|
28
28
|
paddingRight: 24,
|
|
29
|
-
|
|
29
|
+
height: 56
|
|
30
30
|
},
|
|
31
31
|
sticky ? (theme) => ({
|
|
32
32
|
position: "sticky",
|
|
@@ -114,6 +114,7 @@ const PageShell = ({
|
|
|
114
114
|
}
|
|
115
115
|
return page;
|
|
116
116
|
};
|
|
117
|
+
PageShell.Header = PageHeader;
|
|
117
118
|
export {
|
|
118
119
|
PageShell
|
|
119
120
|
};
|
|
@@ -12,11 +12,16 @@ const index_esm = require("../../../node_modules/.pnpm/mantine-react-table@2.0.0
|
|
|
12
12
|
const TablePagination = require("../TablePagination.cjs");
|
|
13
13
|
const helpers = require("./helpers.cjs");
|
|
14
14
|
const Box = require("../../../node_modules/.pnpm/@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/Box/Box.cjs");
|
|
15
|
+
const isTableInstanceProp = (props) => props.table !== void 0;
|
|
15
16
|
const ProTable = (props) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const isInstance = isTableInstanceProp(props);
|
|
18
|
+
let table = helpers.useProTable(isInstance ? { columns: [], data: [] } : props);
|
|
19
|
+
if (isInstance) {
|
|
20
|
+
table = props.table;
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Box.Box, { ...props.wrapperProps, children: [
|
|
23
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index_esm.MantineReactTable, { table }),
|
|
24
|
+
table.options.enablePagination && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(TablePagination.ProTablePagination, { table, ...props.pagination })
|
|
20
25
|
] });
|
|
21
26
|
};
|
|
22
27
|
exports.ProTable = ProTable;
|
|
@@ -7,14 +7,19 @@ import { MantineReactTable } from "../../../node_modules/.pnpm/mantine-react-tab
|
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { ProTablePagination } from "../TablePagination.js";
|
|
11
|
+
import { useProTable } from "./helpers.js";
|
|
12
12
|
import { Box } from "../../../node_modules/.pnpm/@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/Box/Box.js";
|
|
13
|
+
const isTableInstanceProp = (props) => props.table !== void 0;
|
|
13
14
|
const ProTable = (props) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const isInstance = isTableInstanceProp(props);
|
|
16
|
+
let table = useProTable(isInstance ? { columns: [], data: [] } : props);
|
|
17
|
+
if (isInstance) {
|
|
18
|
+
table = props.table;
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { ...props.wrapperProps, children: [
|
|
21
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MantineReactTable, { table }),
|
|
22
|
+
table.options.enablePagination && /* @__PURE__ */ jsxRuntimeExports.jsx(ProTablePagination, { table, ...props.pagination })
|
|
18
23
|
] });
|
|
19
24
|
};
|
|
20
25
|
export {
|
|
@@ -47,11 +47,14 @@ function mergeProTableProps(props) {
|
|
|
47
47
|
mantineTableFooterRowProps = {},
|
|
48
48
|
mantineTableFooterProps = {},
|
|
49
49
|
mantineLoadingOverlayProps = {},
|
|
50
|
+
enablePagination = false,
|
|
51
|
+
enableBottomToolbar,
|
|
50
52
|
layoutMode,
|
|
51
53
|
withBorder = true,
|
|
52
54
|
loading = false,
|
|
53
55
|
enableExpanding = false,
|
|
54
56
|
enableRowVirtualization = false,
|
|
57
|
+
pagination,
|
|
55
58
|
enableStickyHeader,
|
|
56
59
|
enableStickyFooter,
|
|
57
60
|
emptyMessage,
|
|
@@ -67,15 +70,11 @@ function mergeProTableProps(props) {
|
|
|
67
70
|
shadow: "none",
|
|
68
71
|
withBorder,
|
|
69
72
|
sx: (theme2) => ({
|
|
70
|
-
backgroundColor: "
|
|
73
|
+
backgroundColor: "transparent",
|
|
71
74
|
borderRadius: withBorder ? theme2.defaultRadius : 0,
|
|
72
75
|
borderColor: withBorder ? theme2.colors.carbon[4] : "transparent",
|
|
73
76
|
overflow: "hidden",
|
|
74
|
-
transition: "none"
|
|
75
|
-
"& ::-webkit-scrollbar": enableStickyHeader ? {
|
|
76
|
-
width: 0,
|
|
77
|
-
height: 0
|
|
78
|
-
} : void 0
|
|
77
|
+
transition: "none"
|
|
79
78
|
})
|
|
80
79
|
},
|
|
81
80
|
mantinePaperProps
|
|
@@ -154,6 +153,9 @@ function mergeProTableProps(props) {
|
|
|
154
153
|
borderColor: "transparent",
|
|
155
154
|
minWidth: 20,
|
|
156
155
|
minHeight: 20
|
|
156
|
+
},
|
|
157
|
+
".mrt-table-head-cell-resize-handle": {
|
|
158
|
+
marginRight: -7
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
};
|
|
@@ -230,13 +232,17 @@ function mergeProTableProps(props) {
|
|
|
230
232
|
},
|
|
231
233
|
mantineTableFooterProps
|
|
232
234
|
);
|
|
235
|
+
const withPagination = !!pagination;
|
|
233
236
|
return {
|
|
234
237
|
enableColumnActions: false,
|
|
235
238
|
enableColumnFilters: false,
|
|
236
239
|
enableTopToolbar: false,
|
|
237
240
|
enableSorting: false,
|
|
238
|
-
enablePagination:
|
|
239
|
-
enableBottomToolbar:
|
|
241
|
+
enablePagination: withPagination || enablePagination,
|
|
242
|
+
enableBottomToolbar: withPagination || enableBottomToolbar,
|
|
243
|
+
renderBottomToolbar: () => {
|
|
244
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment, {});
|
|
245
|
+
},
|
|
240
246
|
enableExpanding,
|
|
241
247
|
enableStickyHeader,
|
|
242
248
|
enableStickyFooter,
|
|
@@ -45,11 +45,14 @@ function mergeProTableProps(props) {
|
|
|
45
45
|
mantineTableFooterRowProps = {},
|
|
46
46
|
mantineTableFooterProps = {},
|
|
47
47
|
mantineLoadingOverlayProps = {},
|
|
48
|
+
enablePagination = false,
|
|
49
|
+
enableBottomToolbar,
|
|
48
50
|
layoutMode,
|
|
49
51
|
withBorder = true,
|
|
50
52
|
loading = false,
|
|
51
53
|
enableExpanding = false,
|
|
52
54
|
enableRowVirtualization = false,
|
|
55
|
+
pagination,
|
|
53
56
|
enableStickyHeader,
|
|
54
57
|
enableStickyFooter,
|
|
55
58
|
emptyMessage,
|
|
@@ -65,15 +68,11 @@ function mergeProTableProps(props) {
|
|
|
65
68
|
shadow: "none",
|
|
66
69
|
withBorder,
|
|
67
70
|
sx: (theme2) => ({
|
|
68
|
-
backgroundColor: "
|
|
71
|
+
backgroundColor: "transparent",
|
|
69
72
|
borderRadius: withBorder ? theme2.defaultRadius : 0,
|
|
70
73
|
borderColor: withBorder ? theme2.colors.carbon[4] : "transparent",
|
|
71
74
|
overflow: "hidden",
|
|
72
|
-
transition: "none"
|
|
73
|
-
"& ::-webkit-scrollbar": enableStickyHeader ? {
|
|
74
|
-
width: 0,
|
|
75
|
-
height: 0
|
|
76
|
-
} : void 0
|
|
75
|
+
transition: "none"
|
|
77
76
|
})
|
|
78
77
|
},
|
|
79
78
|
mantinePaperProps
|
|
@@ -152,6 +151,9 @@ function mergeProTableProps(props) {
|
|
|
152
151
|
borderColor: "transparent",
|
|
153
152
|
minWidth: 20,
|
|
154
153
|
minHeight: 20
|
|
154
|
+
},
|
|
155
|
+
".mrt-table-head-cell-resize-handle": {
|
|
156
|
+
marginRight: -7
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
};
|
|
@@ -228,13 +230,17 @@ function mergeProTableProps(props) {
|
|
|
228
230
|
},
|
|
229
231
|
mantineTableFooterProps
|
|
230
232
|
);
|
|
233
|
+
const withPagination = !!pagination;
|
|
231
234
|
return {
|
|
232
235
|
enableColumnActions: false,
|
|
233
236
|
enableColumnFilters: false,
|
|
234
237
|
enableTopToolbar: false,
|
|
235
238
|
enableSorting: false,
|
|
236
|
-
enablePagination:
|
|
237
|
-
enableBottomToolbar:
|
|
239
|
+
enablePagination: withPagination || enablePagination,
|
|
240
|
+
enableBottomToolbar: withPagination || enableBottomToolbar,
|
|
241
|
+
renderBottomToolbar: () => {
|
|
242
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
243
|
+
},
|
|
238
244
|
enableExpanding,
|
|
239
245
|
enableStickyHeader,
|
|
240
246
|
enableStickyFooter,
|
|
@@ -9,7 +9,7 @@ type Xor<A, B> = Prettify<A & {
|
|
|
9
9
|
}> | Prettify<B & {
|
|
10
10
|
[k in keyof A]?: never;
|
|
11
11
|
}>;
|
|
12
|
-
type TableInstanceProp<TData extends MRT_RowData> = {
|
|
12
|
+
export type TableInstanceProp<TData extends MRT_RowData> = {
|
|
13
13
|
table: MRT_TableInstance<TData>;
|
|
14
14
|
};
|
|
15
15
|
export interface ProTableExtraProps {
|
|
@@ -9,7 +9,7 @@ type Xor<A, B> = Prettify<A & {
|
|
|
9
9
|
}> | Prettify<B & {
|
|
10
10
|
[k in keyof A]?: never;
|
|
11
11
|
}>;
|
|
12
|
-
type TableInstanceProp<TData extends MRT_RowData> = {
|
|
12
|
+
export type TableInstanceProp<TData extends MRT_RowData> = {
|
|
13
13
|
table: MRT_TableInstance<TData>;
|
|
14
14
|
};
|
|
15
15
|
export interface ProTableExtraProps {
|
|
@@ -7,39 +7,104 @@ const jsxRuntime = require("../../node_modules/.pnpm/react@18.3.1/node_modules/r
|
|
|
7
7
|
;/* empty css */
|
|
8
8
|
;/* empty css */
|
|
9
9
|
;/* empty css */
|
|
10
|
+
const index = require("../../primitive/Select/index.cjs");
|
|
10
11
|
require("clsx");
|
|
11
12
|
const styles = require("../../utils/styles.cjs");
|
|
13
|
+
const Flex = require("../../node_modules/.pnpm/@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/Flex/Flex.cjs");
|
|
14
|
+
const Text = require("../../node_modules/.pnpm/@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/Text/Text.cjs");
|
|
12
15
|
const Pagination = require("../../node_modules/.pnpm/@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/Pagination/Pagination.cjs");
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const parseFromValuesOrFunc = (fn, arg) => fn instanceof Function ? fn(arg) : fn;
|
|
17
|
+
const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100].map((x) => ({ value: x.toString(), label: `${x} / page` }));
|
|
18
|
+
const ProTablePagination = ({ table, ...props }) => {
|
|
19
|
+
const {
|
|
20
|
+
getPrePaginationRowModel,
|
|
21
|
+
getState,
|
|
22
|
+
options: {
|
|
23
|
+
icons: { IconChevronLeft, IconChevronRight },
|
|
24
|
+
mantinePaginationProps,
|
|
25
|
+
rowCount
|
|
26
|
+
},
|
|
27
|
+
setPageIndex,
|
|
28
|
+
setPageSize
|
|
29
|
+
} = table;
|
|
30
|
+
const {
|
|
31
|
+
pagination: { pageIndex = 0, pageSize = 10 }
|
|
32
|
+
} = getState();
|
|
33
|
+
const paginationProps = {
|
|
34
|
+
...parseFromValuesOrFunc(mantinePaginationProps, {
|
|
35
|
+
table
|
|
36
|
+
}),
|
|
37
|
+
...props
|
|
19
38
|
};
|
|
20
|
-
|
|
21
|
-
|
|
39
|
+
const totalRowCount = rowCount ?? getPrePaginationRowModel().rows.length;
|
|
40
|
+
const numberOfPages = Math.ceil(totalRowCount / pageSize);
|
|
41
|
+
const showFirstLastPageButtons = numberOfPages > 2;
|
|
42
|
+
const {
|
|
43
|
+
rowsPerPageOptions = defaultRowsPerPage,
|
|
44
|
+
showRowsPerPage = false,
|
|
45
|
+
showTotal = false,
|
|
46
|
+
withEdges = showFirstLastPageButtons,
|
|
47
|
+
localization,
|
|
48
|
+
...rest
|
|
49
|
+
} = paginationProps ?? {};
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
51
|
+
Flex.Flex,
|
|
22
52
|
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
align: "center",
|
|
54
|
+
justify: !showTotal && !showRowsPerPage ? "center" : showTotal ? "space-between" : "flex-end",
|
|
55
|
+
mt: "xs",
|
|
56
|
+
...paginationProps.wrapperProps,
|
|
57
|
+
children: [
|
|
58
|
+
paginationProps.showTotal && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Flex.Flex, { align: "center", gap: 2, children: [
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Text.Text, { c: "carbon.7", children: [
|
|
60
|
+
(localization == null ? void 0 : localization.total) || "Total:",
|
|
61
|
+
" "
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Text.Text, { c: "carbon.8", children: totalRowCount.toLocaleString() })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Flex.Flex, { align: "center", gap: "xs", children: [
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
67
|
+
Pagination.Pagination,
|
|
68
|
+
{
|
|
69
|
+
nextIcon: IconChevronRight,
|
|
70
|
+
onChange: paginationProps.onChange ?? ((newPageIndex) => setPageIndex(newPageIndex - 1)),
|
|
71
|
+
previousIcon: IconChevronLeft,
|
|
72
|
+
total: (paginationProps == null ? void 0 : paginationProps.total) ?? numberOfPages,
|
|
73
|
+
value: paginationProps.value ?? pageIndex + 1,
|
|
74
|
+
withEdges,
|
|
75
|
+
styles: styles.mergeStylesList([
|
|
76
|
+
(theme) => ({
|
|
77
|
+
control: {
|
|
78
|
+
border: "none",
|
|
79
|
+
color: theme.colors.carbon[9],
|
|
80
|
+
borderRadius: theme.defaultRadius,
|
|
81
|
+
"&[data-active]": {
|
|
82
|
+
color: theme.colors.carbon[9],
|
|
83
|
+
background: theme.colors.carbon[4]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
rest.styles
|
|
88
|
+
]),
|
|
89
|
+
...rest
|
|
37
90
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
91
|
+
),
|
|
92
|
+
(paginationProps == null ? void 0 : paginationProps.showRowsPerPage) !== false && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
93
|
+
index.Select,
|
|
94
|
+
{
|
|
95
|
+
w: 114,
|
|
96
|
+
size: "sm",
|
|
97
|
+
allowDeselect: false,
|
|
98
|
+
"aria-labelledby": "rpp-label",
|
|
99
|
+
data: (paginationProps == null ? void 0 : paginationProps.rowsPerPageOptions) ?? defaultRowsPerPage,
|
|
100
|
+
onChange: (value) => setPageSize(+value),
|
|
101
|
+
value: pageSize.toString()
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] })
|
|
105
|
+
]
|
|
42
106
|
}
|
|
43
107
|
);
|
|
44
108
|
};
|
|
45
|
-
exports.
|
|
109
|
+
exports.ProTablePagination = ProTablePagination;
|
|
110
|
+
exports.parseFromValuesOrFunc = parseFromValuesOrFunc;
|
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { MRT_RowData, MRT_TableInstance } from 'mantine-react-table';
|
|
2
|
+
import { PaginationProps, ComboboxData, FlexProps } from '../../primitive/index.js';
|
|
3
|
+
export declare const parseFromValuesOrFunc: <T, U>(fn: ((arg: U) => T) | T | undefined, arg: U) => T | undefined;
|
|
4
|
+
interface Localization {
|
|
5
|
+
total?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TablePaginationProps extends Partial<PaginationProps> {
|
|
8
|
+
rowsPerPageOptions?: ComboboxData;
|
|
9
|
+
showRowsPerPage?: boolean;
|
|
10
|
+
showTotal?: boolean;
|
|
11
|
+
wrapperProps?: FlexProps;
|
|
12
|
+
/***
|
|
13
|
+
* @deprecated please use wrapper props
|
|
14
|
+
*/
|
|
3
15
|
position?: 'left' | 'right' | 'center' | 'apart';
|
|
16
|
+
/***
|
|
17
|
+
* @deprecated please use mantine-react-table -> state.pagination.pageIndex
|
|
18
|
+
*/
|
|
19
|
+
value?: number;
|
|
20
|
+
/***
|
|
21
|
+
* @deprecated please use mantine-react-table -> rowCount
|
|
22
|
+
*/
|
|
23
|
+
total?: number;
|
|
24
|
+
localization?: Localization;
|
|
25
|
+
}
|
|
26
|
+
interface ProTablePaginationProps<TData extends MRT_RowData> extends TablePaginationProps {
|
|
27
|
+
table: MRT_TableInstance<TData>;
|
|
4
28
|
}
|
|
5
|
-
export declare const
|
|
29
|
+
export declare const ProTablePagination: <TData extends MRT_RowData>({ table, ...props }: ProTablePaginationProps<TData>) => import("react/jsx-runtime.js").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { MRT_RowData, MRT_TableInstance } from 'mantine-react-table';
|
|
2
|
+
import { PaginationProps, ComboboxData, FlexProps } from '../../primitive/index.js';
|
|
3
|
+
export declare const parseFromValuesOrFunc: <T, U>(fn: ((arg: U) => T) | T | undefined, arg: U) => T | undefined;
|
|
4
|
+
interface Localization {
|
|
5
|
+
total?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TablePaginationProps extends Partial<PaginationProps> {
|
|
8
|
+
rowsPerPageOptions?: ComboboxData;
|
|
9
|
+
showRowsPerPage?: boolean;
|
|
10
|
+
showTotal?: boolean;
|
|
11
|
+
wrapperProps?: FlexProps;
|
|
12
|
+
/***
|
|
13
|
+
* @deprecated please use wrapper props
|
|
14
|
+
*/
|
|
3
15
|
position?: 'left' | 'right' | 'center' | 'apart';
|
|
16
|
+
/***
|
|
17
|
+
* @deprecated please use mantine-react-table -> state.pagination.pageIndex
|
|
18
|
+
*/
|
|
19
|
+
value?: number;
|
|
20
|
+
/***
|
|
21
|
+
* @deprecated please use mantine-react-table -> rowCount
|
|
22
|
+
*/
|
|
23
|
+
total?: number;
|
|
24
|
+
localization?: Localization;
|
|
25
|
+
}
|
|
26
|
+
interface ProTablePaginationProps<TData extends MRT_RowData> extends TablePaginationProps {
|
|
27
|
+
table: MRT_TableInstance<TData>;
|
|
4
28
|
}
|
|
5
|
-
export declare const
|
|
29
|
+
export declare const ProTablePagination: <TData extends MRT_RowData>({ table, ...props }: ProTablePaginationProps<TData>) => import("react/jsx-runtime.js").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -5,41 +5,106 @@ import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.3.1/no
|
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
7
|
/* empty css */
|
|
8
|
+
import { Select } from "../../primitive/Select/index.js";
|
|
8
9
|
import "clsx";
|
|
9
10
|
import { mergeStylesList } from "../../utils/styles.js";
|
|
11
|
+
import { Flex } from "../../node_modules/.pnpm/@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/Flex/Flex.js";
|
|
12
|
+
import { Text } from "../../node_modules/.pnpm/@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/Text/Text.js";
|
|
10
13
|
import { Pagination } from "../../node_modules/.pnpm/@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/Pagination/Pagination.js";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const parseFromValuesOrFunc = (fn, arg) => fn instanceof Function ? fn(arg) : fn;
|
|
15
|
+
const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100].map((x) => ({ value: x.toString(), label: `${x} / page` }));
|
|
16
|
+
const ProTablePagination = ({ table, ...props }) => {
|
|
17
|
+
const {
|
|
18
|
+
getPrePaginationRowModel,
|
|
19
|
+
getState,
|
|
20
|
+
options: {
|
|
21
|
+
icons: { IconChevronLeft, IconChevronRight },
|
|
22
|
+
mantinePaginationProps,
|
|
23
|
+
rowCount
|
|
24
|
+
},
|
|
25
|
+
setPageIndex,
|
|
26
|
+
setPageSize
|
|
27
|
+
} = table;
|
|
28
|
+
const {
|
|
29
|
+
pagination: { pageIndex = 0, pageSize = 10 }
|
|
30
|
+
} = getState();
|
|
31
|
+
const paginationProps = {
|
|
32
|
+
...parseFromValuesOrFunc(mantinePaginationProps, {
|
|
33
|
+
table
|
|
34
|
+
}),
|
|
35
|
+
...props
|
|
17
36
|
};
|
|
18
|
-
|
|
19
|
-
|
|
37
|
+
const totalRowCount = rowCount ?? getPrePaginationRowModel().rows.length;
|
|
38
|
+
const numberOfPages = Math.ceil(totalRowCount / pageSize);
|
|
39
|
+
const showFirstLastPageButtons = numberOfPages > 2;
|
|
40
|
+
const {
|
|
41
|
+
rowsPerPageOptions = defaultRowsPerPage,
|
|
42
|
+
showRowsPerPage = false,
|
|
43
|
+
showTotal = false,
|
|
44
|
+
withEdges = showFirstLastPageButtons,
|
|
45
|
+
localization,
|
|
46
|
+
...rest
|
|
47
|
+
} = paginationProps ?? {};
|
|
48
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
49
|
+
Flex,
|
|
20
50
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
51
|
+
align: "center",
|
|
52
|
+
justify: !showTotal && !showRowsPerPage ? "center" : showTotal ? "space-between" : "flex-end",
|
|
53
|
+
mt: "xs",
|
|
54
|
+
...paginationProps.wrapperProps,
|
|
55
|
+
children: [
|
|
56
|
+
paginationProps.showTotal && /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { align: "center", gap: 2, children: [
|
|
57
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { c: "carbon.7", children: [
|
|
58
|
+
(localization == null ? void 0 : localization.total) || "Total:",
|
|
59
|
+
" "
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { c: "carbon.8", children: totalRowCount.toLocaleString() })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { align: "center", gap: "xs", children: [
|
|
64
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
65
|
+
Pagination,
|
|
66
|
+
{
|
|
67
|
+
nextIcon: IconChevronRight,
|
|
68
|
+
onChange: paginationProps.onChange ?? ((newPageIndex) => setPageIndex(newPageIndex - 1)),
|
|
69
|
+
previousIcon: IconChevronLeft,
|
|
70
|
+
total: (paginationProps == null ? void 0 : paginationProps.total) ?? numberOfPages,
|
|
71
|
+
value: paginationProps.value ?? pageIndex + 1,
|
|
72
|
+
withEdges,
|
|
73
|
+
styles: mergeStylesList([
|
|
74
|
+
(theme) => ({
|
|
75
|
+
control: {
|
|
76
|
+
border: "none",
|
|
77
|
+
color: theme.colors.carbon[9],
|
|
78
|
+
borderRadius: theme.defaultRadius,
|
|
79
|
+
"&[data-active]": {
|
|
80
|
+
color: theme.colors.carbon[9],
|
|
81
|
+
background: theme.colors.carbon[4]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
rest.styles
|
|
86
|
+
]),
|
|
87
|
+
...rest
|
|
35
88
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
89
|
+
),
|
|
90
|
+
(paginationProps == null ? void 0 : paginationProps.showRowsPerPage) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
91
|
+
Select,
|
|
92
|
+
{
|
|
93
|
+
w: 114,
|
|
94
|
+
size: "sm",
|
|
95
|
+
allowDeselect: false,
|
|
96
|
+
"aria-labelledby": "rpp-label",
|
|
97
|
+
data: (paginationProps == null ? void 0 : paginationProps.rowsPerPageOptions) ?? defaultRowsPerPage,
|
|
98
|
+
onChange: (value) => setPageSize(+value),
|
|
99
|
+
value: pageSize.toString()
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] })
|
|
103
|
+
]
|
|
40
104
|
}
|
|
41
105
|
);
|
|
42
106
|
};
|
|
43
107
|
export {
|
|
44
|
-
|
|
108
|
+
ProTablePagination,
|
|
109
|
+
parseFromValuesOrFunc
|
|
45
110
|
};
|
package/dist/biz/Tree/index.cjs
CHANGED
|
@@ -174,7 +174,7 @@ const Tree = React.forwardRef((props, ref) => {
|
|
|
174
174
|
left: "50%",
|
|
175
175
|
width: 8,
|
|
176
176
|
height: 8,
|
|
177
|
-
backgroundColor: theme.colors.
|
|
177
|
+
backgroundColor: theme.colors.carbon[8],
|
|
178
178
|
border: 0,
|
|
179
179
|
transform: "translate(-50%, -50%) scale(1)",
|
|
180
180
|
opacity: 1,
|
package/dist/biz/Tree/index.js
CHANGED
|
@@ -172,7 +172,7 @@ const Tree = React__default.forwardRef((props, ref) => {
|
|
|
172
172
|
left: "50%",
|
|
173
173
|
width: 8,
|
|
174
174
|
height: 8,
|
|
175
|
-
backgroundColor: theme.colors.
|
|
175
|
+
backgroundColor: theme.colors.carbon[8],
|
|
176
176
|
border: 0,
|
|
177
177
|
transform: "translate(-50%, -50%) scale(1)",
|
|
178
178
|
opacity: 1,
|
package/dist/theme/colors.cjs
CHANGED
|
@@ -2,15 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const carbon = [
|
|
4
4
|
"#FFFFFF",
|
|
5
|
+
// 0
|
|
5
6
|
"#FDFEFF",
|
|
7
|
+
// 1
|
|
6
8
|
"#F9FAFB",
|
|
9
|
+
// 2
|
|
7
10
|
"#EDF1F2",
|
|
11
|
+
// 3
|
|
8
12
|
"#DCE3E5",
|
|
13
|
+
// 4
|
|
9
14
|
"#C4CDD0",
|
|
15
|
+
// 5
|
|
10
16
|
"#9FA9AD",
|
|
17
|
+
// 6
|
|
11
18
|
"#6F787B",
|
|
19
|
+
// 7
|
|
12
20
|
"#383E40",
|
|
21
|
+
// 8
|
|
13
22
|
"#1E2426"
|
|
23
|
+
// 9
|
|
14
24
|
];
|
|
15
25
|
const peacock = [
|
|
16
26
|
"#FBFDFE",
|
|
@@ -2,15 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const carbon = [
|
|
4
4
|
"#14181A",
|
|
5
|
+
// 0
|
|
5
6
|
"#111517",
|
|
7
|
+
// 1
|
|
6
8
|
"#1F2426",
|
|
9
|
+
// 2
|
|
7
10
|
"#25292B",
|
|
11
|
+
// 3
|
|
8
12
|
"#313638",
|
|
13
|
+
// 4
|
|
9
14
|
"#43494D",
|
|
15
|
+
// 5
|
|
10
16
|
"#50585C",
|
|
17
|
+
// 6
|
|
11
18
|
"#79848A",
|
|
19
|
+
// 7
|
|
12
20
|
"#ACB9BF",
|
|
21
|
+
// 8
|
|
13
22
|
"#DAE2E5"
|
|
23
|
+
// 9
|
|
14
24
|
];
|
|
15
25
|
const peacock = [
|
|
16
26
|
"#11171A",
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
const carbon = [
|
|
2
2
|
"#14181A",
|
|
3
|
+
// 0
|
|
3
4
|
"#111517",
|
|
5
|
+
// 1
|
|
4
6
|
"#1F2426",
|
|
7
|
+
// 2
|
|
5
8
|
"#25292B",
|
|
9
|
+
// 3
|
|
6
10
|
"#313638",
|
|
11
|
+
// 4
|
|
7
12
|
"#43494D",
|
|
13
|
+
// 5
|
|
8
14
|
"#50585C",
|
|
15
|
+
// 6
|
|
9
16
|
"#79848A",
|
|
17
|
+
// 7
|
|
10
18
|
"#ACB9BF",
|
|
19
|
+
// 8
|
|
11
20
|
"#DAE2E5"
|
|
21
|
+
// 9
|
|
12
22
|
];
|
|
13
23
|
const peacock = [
|
|
14
24
|
"#11171A",
|
package/dist/theme/colors.js
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
const carbon = [
|
|
2
2
|
"#FFFFFF",
|
|
3
|
+
// 0
|
|
3
4
|
"#FDFEFF",
|
|
5
|
+
// 1
|
|
4
6
|
"#F9FAFB",
|
|
7
|
+
// 2
|
|
5
8
|
"#EDF1F2",
|
|
9
|
+
// 3
|
|
6
10
|
"#DCE3E5",
|
|
11
|
+
// 4
|
|
7
12
|
"#C4CDD0",
|
|
13
|
+
// 5
|
|
8
14
|
"#9FA9AD",
|
|
15
|
+
// 6
|
|
9
16
|
"#6F787B",
|
|
17
|
+
// 7
|
|
10
18
|
"#383E40",
|
|
19
|
+
// 8
|
|
11
20
|
"#1E2426"
|
|
21
|
+
// 9
|
|
12
22
|
];
|
|
13
23
|
const peacock = [
|
|
14
24
|
"#FBFDFE",
|
package/dist/theme/theme.cjs
CHANGED
|
@@ -548,7 +548,8 @@ const theme = createTheme.createTheme({
|
|
|
548
548
|
Select: {
|
|
549
549
|
defaultProps: {
|
|
550
550
|
size: "md",
|
|
551
|
-
withCheckIcon:
|
|
551
|
+
withCheckIcon: true,
|
|
552
|
+
checkIconPosition: "right"
|
|
552
553
|
},
|
|
553
554
|
styles: (theme2, props) => {
|
|
554
555
|
return {
|
|
@@ -589,6 +590,11 @@ const theme = createTheme.createTheme({
|
|
|
589
590
|
backgroundColor: "transparent",
|
|
590
591
|
"&:hover": {
|
|
591
592
|
backgroundColor: themeColor(theme2, "carbon", 3)
|
|
593
|
+
},
|
|
594
|
+
// check icon color
|
|
595
|
+
"& > svg": {
|
|
596
|
+
color: themeColor(theme2, "carbon", 9),
|
|
597
|
+
opacity: 1
|
|
592
598
|
}
|
|
593
599
|
}
|
|
594
600
|
},
|
|
@@ -596,6 +602,10 @@ const theme = createTheme.createTheme({
|
|
|
596
602
|
"& > svg": {
|
|
597
603
|
color: `${themeColor(theme2, "carbon", 7)} !important`
|
|
598
604
|
}
|
|
605
|
+
},
|
|
606
|
+
dropdown: {
|
|
607
|
+
"--popover-border-color": themeColor(theme2, "carbon", 3),
|
|
608
|
+
"--popover-shadow": "0px 8px 32px 0px #00000014"
|
|
599
609
|
}
|
|
600
610
|
};
|
|
601
611
|
}
|
package/dist/theme/theme.js
CHANGED
|
@@ -546,7 +546,8 @@ const theme = createTheme({
|
|
|
546
546
|
Select: {
|
|
547
547
|
defaultProps: {
|
|
548
548
|
size: "md",
|
|
549
|
-
withCheckIcon:
|
|
549
|
+
withCheckIcon: true,
|
|
550
|
+
checkIconPosition: "right"
|
|
550
551
|
},
|
|
551
552
|
styles: (theme2, props) => {
|
|
552
553
|
return {
|
|
@@ -587,6 +588,11 @@ const theme = createTheme({
|
|
|
587
588
|
backgroundColor: "transparent",
|
|
588
589
|
"&:hover": {
|
|
589
590
|
backgroundColor: themeColor(theme2, "carbon", 3)
|
|
591
|
+
},
|
|
592
|
+
// check icon color
|
|
593
|
+
"& > svg": {
|
|
594
|
+
color: themeColor(theme2, "carbon", 9),
|
|
595
|
+
opacity: 1
|
|
590
596
|
}
|
|
591
597
|
}
|
|
592
598
|
},
|
|
@@ -594,6 +600,10 @@ const theme = createTheme({
|
|
|
594
600
|
"& > svg": {
|
|
595
601
|
color: `${themeColor(theme2, "carbon", 7)} !important`
|
|
596
602
|
}
|
|
603
|
+
},
|
|
604
|
+
dropdown: {
|
|
605
|
+
"--popover-border-color": themeColor(theme2, "carbon", 3),
|
|
606
|
+
"--popover-shadow": "0px 8px 32px 0px #00000014"
|
|
597
607
|
}
|
|
598
608
|
};
|
|
599
609
|
}
|