@xyo-network/react-payload-table 3.0.1 → 3.0.3
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/browser/components/DynamicTable/DynamicTableRow.d.ts +15 -0
- package/dist/browser/components/DynamicTable/DynamicTableRow.d.ts.map +1 -0
- package/dist/browser/components/DynamicTable/PayloadDynamicTableColumnConfig.d.ts +16 -0
- package/dist/browser/components/DynamicTable/PayloadDynamicTableColumnConfig.d.ts.map +1 -0
- package/dist/browser/components/DynamicTable/Table.d.ts +14 -0
- package/dist/browser/components/DynamicTable/Table.d.ts.map +1 -0
- package/dist/browser/components/DynamicTable/index.d.ts +4 -0
- package/dist/browser/components/DynamicTable/index.d.ts.map +1 -0
- package/dist/browser/components/Table/PayloadTableColumnConfig.d.ts +11 -0
- package/dist/browser/components/Table/PayloadTableColumnConfig.d.ts.map +1 -0
- package/dist/browser/components/Table/Table.d.ts +26 -0
- package/dist/browser/components/Table/Table.d.ts.map +1 -0
- package/dist/browser/components/Table/TableBody.d.ts +4 -0
- package/dist/browser/components/Table/TableBody.d.ts.map +1 -0
- package/dist/browser/components/Table/TableFooter.d.ts +4 -0
- package/dist/browser/components/Table/TableFooter.d.ts.map +1 -0
- package/dist/browser/components/Table/TableHead.d.ts +4 -0
- package/dist/browser/components/Table/TableHead.d.ts.map +1 -0
- package/dist/browser/components/Table/TablePagination.d.ts +11 -0
- package/dist/browser/components/Table/TablePagination.d.ts.map +1 -0
- package/dist/browser/components/Table/TableRow.d.ts +16 -0
- package/dist/browser/components/Table/TableRow.d.ts.map +1 -0
- package/dist/browser/components/Table/TableRowNoData.d.ts +9 -0
- package/dist/browser/components/Table/TableRowNoData.d.ts.map +1 -0
- package/dist/browser/components/Table/index.d.ts +7 -0
- package/dist/browser/components/Table/index.d.ts.map +1 -0
- package/dist/browser/components/Table/types/PaginationEventNouns.d.ts +2 -0
- package/dist/browser/components/Table/types/PaginationEventNouns.d.ts.map +1 -0
- package/dist/browser/components/Table/types/PayloadTableBodyProps.d.ts +17 -0
- package/dist/browser/components/Table/types/PayloadTableBodyProps.d.ts.map +1 -0
- package/dist/browser/components/Table/types/PayloadTableFooterProps.d.ts +13 -0
- package/dist/browser/components/Table/types/PayloadTableFooterProps.d.ts.map +1 -0
- package/dist/browser/components/Table/types/PayloadTableHeadProps.d.ts +6 -0
- package/dist/browser/components/Table/types/PayloadTableHeadProps.d.ts.map +1 -0
- package/dist/browser/components/Table/types/index.d.ts +5 -0
- package/dist/browser/components/Table/types/index.d.ts.map +1 -0
- package/dist/browser/components/index.d.ts +3 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/index.d.ts +2 -133
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +65 -57
- package/src/components/DynamicTable/DynamicTable.stories.tsx +8 -8
- package/src/components/DynamicTable/DynamicTableRow.tsx +14 -7
- package/src/components/DynamicTable/PayloadDynamicTableColumnConfig.ts +66 -22
- package/src/components/DynamicTable/Table.tsx +15 -9
- package/src/components/Table/FetchMoreTable.stories.tsx +10 -9
- package/src/components/Table/PayloadTableColumnConfig.ts +3 -1
- package/src/components/Table/Table.stories.tsx +12 -13
- package/src/components/Table/Table.tsx +12 -6
- package/src/components/Table/TableBody.tsx +6 -3
- package/src/components/Table/TableFooter.tsx +6 -8
- package/src/components/Table/TableHead.tsx +4 -2
- package/src/components/Table/TablePagination.tsx +18 -5
- package/src/components/Table/TableRow.tsx +8 -4
- package/src/components/Table/TableRowNoData.tsx +8 -5
- package/src/components/Table/types/PayloadTableBodyProps.ts +5 -5
- package/src/components/Table/types/PayloadTableFooterProps.ts +2 -2
- package/src/components/Table/types/PayloadTableHeadProps.ts +2 -2
- package/xy.config.ts +2 -4
|
@@ -20,35 +20,79 @@ export interface PayloadDynamicTableColumnConfig {
|
|
|
20
20
|
|
|
21
21
|
export const payloadDynamicTableColumnConfigDefaults = (): PayloadDynamicTableColumnConfig => {
|
|
22
22
|
const xs: PayloadDynamicTableColumnHeadData[] = [
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
{
|
|
24
|
+
alignment: 'left', name: 'Hash', slug: 'hash', width: '100%',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
alignment: 'left', name: 'Schema', slug: 'schema', width: '50px',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
alignment: 'left', name: 'Valid', slug: 'valid', width: '50px',
|
|
31
|
+
},
|
|
26
32
|
]
|
|
27
33
|
const sm: PayloadDynamicTableColumnHeadData[] = [
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
34
|
+
{
|
|
35
|
+
alignment: 'left', name: 'Icon', slug: 'icon', width: '50px',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
alignment: 'left', name: 'Hash', slug: 'hash', width: '100%',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
alignment: 'left', name: 'Schema', slug: 'schema', width: '50px',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
alignment: 'left', name: 'Valid', slug: 'valid', width: '50px',
|
|
45
|
+
},
|
|
32
46
|
]
|
|
33
47
|
const md: PayloadDynamicTableColumnHeadData[] = [
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{
|
|
48
|
+
{
|
|
49
|
+
alignment: 'left', name: 'Icon', slug: 'icon', width: '50px',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
alignment: 'left', name: 'Hash', slug: 'hash', width: '100%',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
alignment: 'left', name: 'Schema', slug: 'schema', width: '50px',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
alignment: 'left', name: 'Valid', slug: 'valid', width: '50px',
|
|
59
|
+
},
|
|
38
60
|
]
|
|
39
61
|
const lg: PayloadDynamicTableColumnHeadData[] = [
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
|
|
62
|
+
{
|
|
63
|
+
alignment: 'left', name: 'Icon', slug: 'icon', width: '50px',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
alignment: 'left', name: 'Hash', slug: 'hash', width: '100%',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
alignment: 'left', name: 'Schema', slug: 'schema', width: '50px',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
alignment: 'left', name: 'Render', slug: 'render', width: '50px',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
alignment: 'left', name: 'Valid', slug: 'valid', width: '50px',
|
|
76
|
+
},
|
|
45
77
|
]
|
|
46
78
|
const xl: PayloadDynamicTableColumnHeadData[] = [
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
|
|
79
|
+
{
|
|
80
|
+
alignment: 'left', name: 'Icon', slug: 'icon', width: '50px',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
alignment: 'left', name: 'Hash', slug: 'hash', width: '100%',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
alignment: 'left', name: 'Schema', slug: 'schema', width: '50px',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
alignment: 'left', name: 'Render', slug: 'render', width: '50px',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
alignment: 'left', name: 'Valid', slug: 'valid', width: '50px',
|
|
93
|
+
},
|
|
52
94
|
]
|
|
53
|
-
return {
|
|
95
|
+
return {
|
|
96
|
+
lg, md, sm, xl, xs,
|
|
97
|
+
}
|
|
54
98
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FirstPage as FirstPageIcon, KeyboardArrowLeft, KeyboardArrowRight, LastPage as LastPageIcon,
|
|
3
|
+
} from '@mui/icons-material'
|
|
4
|
+
import type { TableProps } from '@mui/material'
|
|
2
5
|
import {
|
|
3
6
|
Alert,
|
|
4
7
|
Box,
|
|
@@ -9,19 +12,22 @@ import {
|
|
|
9
12
|
TableFooter,
|
|
10
13
|
TableHead,
|
|
11
14
|
TablePagination,
|
|
12
|
-
TableProps,
|
|
13
15
|
TableRow,
|
|
14
16
|
Typography,
|
|
15
17
|
useTheme,
|
|
16
18
|
} from '@mui/material'
|
|
17
19
|
import { useBreakpoint } from '@xylabs/react-shared'
|
|
18
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
20
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
19
21
|
import { ThrownErrorBoundary } from '@xyo-network/react-error'
|
|
20
22
|
import { usePayloadHashes } from '@xyo-network/react-shared'
|
|
21
|
-
import
|
|
23
|
+
import type { ReactNode } from 'react'
|
|
24
|
+
import React, {
|
|
25
|
+
useEffect, useMemo, useState,
|
|
26
|
+
} from 'react'
|
|
22
27
|
|
|
23
28
|
import { PayloadDynamicTableRow } from './DynamicTableRow.tsx'
|
|
24
|
-
import { PayloadDynamicTableColumnConfig
|
|
29
|
+
import type { PayloadDynamicTableColumnConfig } from './PayloadDynamicTableColumnConfig.ts'
|
|
30
|
+
import { payloadDynamicTableColumnConfigDefaults } from './PayloadDynamicTableColumnConfig.ts'
|
|
25
31
|
|
|
26
32
|
export interface PayloadDynamicTableProps extends TableProps {
|
|
27
33
|
archive?: string
|
|
@@ -41,7 +47,9 @@ interface TablePaginationActionsProps {
|
|
|
41
47
|
|
|
42
48
|
function TablePaginationActions(props: TablePaginationActionsProps) {
|
|
43
49
|
const theme = useTheme()
|
|
44
|
-
const {
|
|
50
|
+
const {
|
|
51
|
+
count, page, rowsPerPage, onPageChange,
|
|
52
|
+
} = props
|
|
45
53
|
|
|
46
54
|
const handleFirstPageButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
47
55
|
onPageChange(event, 0)
|
|
@@ -176,9 +184,7 @@ export const PayloadDynamicTable: React.FC<PayloadDynamicTableProps> = ({
|
|
|
176
184
|
rowsPerPage={rowsPerPage}
|
|
177
185
|
page={page}
|
|
178
186
|
SelectProps={{
|
|
179
|
-
inputProps: {
|
|
180
|
-
'aria-label': 'rows per page',
|
|
181
|
-
},
|
|
187
|
+
inputProps: { 'aria-label': 'rows per page' },
|
|
182
188
|
native: true,
|
|
183
189
|
}}
|
|
184
190
|
onPageChange={handleChangePage}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Button, Typography } from '@mui/material'
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
|
+
Decorator, Meta, StoryFn,
|
|
4
|
+
} from '@storybook/react'
|
|
3
5
|
import { delay } from '@xylabs/delay'
|
|
4
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
6
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
5
7
|
import { useEvent } from '@xyo-network/react-event'
|
|
6
8
|
import React, { useEffect, useState } from 'react'
|
|
7
9
|
import { BrowserRouter } from 'react-router-dom'
|
|
@@ -12,7 +14,9 @@ const newPayloads = () =>
|
|
|
12
14
|
Array(50)
|
|
13
15
|
// eslint-disable-next-line unicorn/no-useless-undefined
|
|
14
16
|
.fill(undefined)
|
|
15
|
-
.map((_, index) => ({
|
|
17
|
+
.map((_, index) => ({
|
|
18
|
+
index, random: Math.random(), schema: 'network.xyo.stories.test',
|
|
19
|
+
}))
|
|
16
20
|
|
|
17
21
|
// simulating the end of the list
|
|
18
22
|
const maxPayloads = 200
|
|
@@ -31,9 +35,10 @@ const NewPayloadsDecorator: Decorator = (Story, args) => {
|
|
|
31
35
|
|
|
32
36
|
useEffect(() => {
|
|
33
37
|
// simulate initial async payloads
|
|
34
|
-
setTimeout(() => {
|
|
38
|
+
const timeout = setTimeout(() => {
|
|
35
39
|
addToTotalPayloads(testPayloads)
|
|
36
40
|
}, 500)
|
|
41
|
+
return () => clearTimeout(timeout)
|
|
37
42
|
}, [])
|
|
38
43
|
|
|
39
44
|
const addPayloads = () => {
|
|
@@ -73,11 +78,7 @@ const NewPayloadsDecorator: Decorator = (Story, args) => {
|
|
|
73
78
|
const StorybookEntry = {
|
|
74
79
|
argTypes: {},
|
|
75
80
|
component: PayloadTable,
|
|
76
|
-
parameters: {
|
|
77
|
-
docs: {
|
|
78
|
-
page: null,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
+
parameters: { docs: { page: null } },
|
|
81
82
|
title: 'payload/FetchMoreTable',
|
|
82
83
|
} as Meta<typeof PayloadTable>
|
|
83
84
|
|
|
@@ -23,5 +23,7 @@ export const payloadTableColumnConfigDefaults = (): PayloadTableColumnConfig =>
|
|
|
23
23
|
const md: PayloadTableColumnSlug[] = ['hash', 'schema', 'valid']
|
|
24
24
|
const lg: PayloadTableColumnSlug[] = ['hash', 'schema', 'valid']
|
|
25
25
|
const xl: PayloadTableColumnSlug[] = ['hash', 'schema', 'valid']
|
|
26
|
-
return {
|
|
26
|
+
return {
|
|
27
|
+
lg, md, sm, xl, xs,
|
|
28
|
+
}
|
|
27
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Chip } from '@mui/material'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
3
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
2
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
3
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
4
4
|
import { useEvent } from '@xyo-network/react-event'
|
|
5
5
|
import { sampleIdPayload, sampleSystemInfoBrowserPayload } from '@xyo-network/react-storybook'
|
|
6
6
|
import React, { useState } from 'react'
|
|
@@ -11,11 +11,7 @@ import { PayloadTable } from './Table.tsx'
|
|
|
11
11
|
const StorybookEntry = {
|
|
12
12
|
argTypes: {},
|
|
13
13
|
component: PayloadTable,
|
|
14
|
-
parameters: {
|
|
15
|
-
docs: {
|
|
16
|
-
page: null,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
14
|
+
parameters: { docs: { page: null } },
|
|
19
15
|
title: 'payload/Table',
|
|
20
16
|
} as Meta<typeof PayloadTable>
|
|
21
17
|
|
|
@@ -55,9 +51,7 @@ const payloads: Payload[] = [
|
|
|
55
51
|
]
|
|
56
52
|
|
|
57
53
|
const WithData = Template.bind({})
|
|
58
|
-
WithData.args = {
|
|
59
|
-
payloads,
|
|
60
|
-
}
|
|
54
|
+
WithData.args = { payloads }
|
|
61
55
|
|
|
62
56
|
const WithOutStickyHeaderFooter = Template.bind({})
|
|
63
57
|
WithOutStickyHeaderFooter.args = {
|
|
@@ -72,8 +66,11 @@ WithDataAndMaxSchemaDepth.args = {
|
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
const WithInvalid = Template.bind({})
|
|
75
|
-
|
|
76
|
-
const {
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
72
|
+
schema, ...badPayload
|
|
73
|
+
} = sampleIdPayload
|
|
77
74
|
|
|
78
75
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
79
76
|
// @ts-ignore
|
|
@@ -85,6 +82,8 @@ WithNoResults.args = { payloads: [] }
|
|
|
85
82
|
const WithLoading = Template.bind({})
|
|
86
83
|
WithLoading.args = { loading: true, payloads: [] }
|
|
87
84
|
|
|
88
|
-
export {
|
|
85
|
+
export {
|
|
86
|
+
Default, WithData, WithDataAndMaxSchemaDepth, WithInvalid, WithLoading, WithNoResults, WithOutStickyHeaderFooter,
|
|
87
|
+
}
|
|
89
88
|
|
|
90
89
|
export default StorybookEntry
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { Hash } from '@xylabs/hex'
|
|
2
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
3
|
+
import type { TableExProps } from '@xyo-network/react-table'
|
|
4
|
+
import { TableEx } from '@xyo-network/react-table'
|
|
5
|
+
import type { ComponentType } from 'react'
|
|
6
|
+
import React, {
|
|
7
|
+
forwardRef, useEffect, useMemo, useState,
|
|
8
|
+
} from 'react'
|
|
5
9
|
|
|
6
|
-
import { PayloadTableColumnConfig } from './PayloadTableColumnConfig.ts'
|
|
10
|
+
import type { PayloadTableColumnConfig } from './PayloadTableColumnConfig.ts'
|
|
7
11
|
import { PayloadTableBody } from './TableBody.tsx'
|
|
8
12
|
import { PayloadTableFooter } from './TableFooter.tsx'
|
|
9
13
|
import { PayloadTableHead } from './TableHead.tsx'
|
|
10
14
|
import { TableRowNoData } from './TableRowNoData.tsx'
|
|
11
|
-
import {
|
|
15
|
+
import type {
|
|
16
|
+
PayloadTableBodyProps, PayloadTableFooterProps, PayloadTableHeadProps,
|
|
17
|
+
} from './types/index.ts'
|
|
12
18
|
|
|
13
19
|
export interface PayloadTableProps extends TableExProps {
|
|
14
20
|
PayloadTableBodyComponent?: ComponentType<PayloadTableBodyProps>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Alert, TableBody, Typography,
|
|
3
|
+
} from '@mui/material'
|
|
2
4
|
import { ThrownErrorBoundary } from '@xyo-network/react-error'
|
|
3
5
|
import { usePayloadHashes } from '@xyo-network/react-shared'
|
|
4
|
-
import
|
|
6
|
+
import type { ReactNode } from 'react'
|
|
7
|
+
import React from 'react'
|
|
5
8
|
|
|
6
9
|
import { PayloadTableRow } from './TableRow.tsx'
|
|
7
|
-
import { PayloadTableBodyProps } from './types/index.ts'
|
|
10
|
+
import type { PayloadTableBodyProps } from './types/index.ts'
|
|
8
11
|
|
|
9
12
|
export const PayloadTableBody: React.FC<PayloadTableBodyProps> = ({
|
|
10
13
|
children,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
styled, TablePagination, TableRow,
|
|
3
|
+
} from '@mui/material'
|
|
2
4
|
import { TableFooterEx } from '@xyo-network/react-table'
|
|
3
5
|
import React from 'react'
|
|
4
6
|
|
|
5
7
|
import { TablePaginationActions } from './TablePagination.tsx'
|
|
6
|
-
import { PayloadTableFooterProps } from './types/index.ts'
|
|
8
|
+
import type { PayloadTableFooterProps } from './types/index.ts'
|
|
7
9
|
|
|
8
10
|
export const PayloadTableFooter: React.FC<PayloadTableFooterProps> = ({
|
|
9
11
|
count,
|
|
@@ -23,9 +25,7 @@ export const PayloadTableFooter: React.FC<PayloadTableFooterProps> = ({
|
|
|
23
25
|
rowsPerPage={rowsPerPage ?? 10}
|
|
24
26
|
page={page ?? 0}
|
|
25
27
|
SelectProps={{
|
|
26
|
-
inputProps: {
|
|
27
|
-
'aria-label': 'rows per page',
|
|
28
|
-
},
|
|
28
|
+
inputProps: { 'aria-label': 'rows per page' },
|
|
29
29
|
native: true,
|
|
30
30
|
}}
|
|
31
31
|
onPageChange={handleChangePage ?? (() => {})}
|
|
@@ -38,9 +38,7 @@ export const PayloadTableFooter: React.FC<PayloadTableFooterProps> = ({
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
const StyledTablePagination = styled(TablePagination)(({ theme }) => ({
|
|
41
|
-
'& > .MuiToolbar-root': {
|
|
42
|
-
paddingLeft: theme.spacing(1),
|
|
43
|
-
},
|
|
41
|
+
'& > .MuiToolbar-root': { paddingLeft: theme.spacing(1) },
|
|
44
42
|
'borderTop': '1px solid',
|
|
45
43
|
'borderTopColor': theme.palette.divider,
|
|
46
44
|
}))
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TableCell, TableHead, TableRow, Typography,
|
|
3
|
+
} from '@mui/material'
|
|
2
4
|
import { useBreakpoint } from '@xylabs/react-shared'
|
|
3
5
|
import React, { useMemo } from 'react'
|
|
4
6
|
|
|
5
7
|
import { payloadColumnNames, payloadTableColumnConfigDefaults } from './PayloadTableColumnConfig.ts'
|
|
6
|
-
import { PayloadTableHeadProps } from './types/index.ts'
|
|
8
|
+
import type { PayloadTableHeadProps } from './types/index.ts'
|
|
7
9
|
|
|
8
10
|
export const PayloadTableHead: React.FC<PayloadTableHeadProps> = ({ columns, ...props }) => {
|
|
9
11
|
const breakPoint = useBreakpoint()
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
FirstPage as FirstPageIcon, KeyboardArrowLeft, KeyboardArrowRight, LastPage as LastPageIcon,
|
|
3
|
+
} from '@mui/icons-material'
|
|
4
|
+
import {
|
|
5
|
+
Box, CircularProgress, IconButton, useTheme,
|
|
6
|
+
} from '@mui/material'
|
|
3
7
|
import { useEvent } from '@xyo-network/react-event'
|
|
4
8
|
import React from 'react'
|
|
5
9
|
|
|
6
|
-
import { PaginationNouns } from './types/index.ts'
|
|
10
|
+
import type { PaginationNouns } from './types/index.ts'
|
|
7
11
|
|
|
8
12
|
export interface TablePaginationActionsProps {
|
|
9
13
|
count: number
|
|
@@ -14,7 +18,9 @@ export interface TablePaginationActionsProps {
|
|
|
14
18
|
rowsPerPage: number
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
export function TablePaginationActions({
|
|
21
|
+
export function TablePaginationActions({
|
|
22
|
+
count, enableNextPage, loading, onPageChange, page, rowsPerPage,
|
|
23
|
+
}: TablePaginationActionsProps) {
|
|
18
24
|
const theme = useTheme()
|
|
19
25
|
const [paginationRef, paginationDispatch] = useEvent<HTMLButtonElement, PaginationNouns>()
|
|
20
26
|
|
|
@@ -41,7 +47,14 @@ export function TablePaginationActions({ count, enableNextPage, loading, onPageC
|
|
|
41
47
|
return (
|
|
42
48
|
<>
|
|
43
49
|
{loading
|
|
44
|
-
?
|
|
50
|
+
? (
|
|
51
|
+
<CircularProgress
|
|
52
|
+
size="small"
|
|
53
|
+
sx={{
|
|
54
|
+
height: theme.spacing(2), position: 'absolute', width: theme.spacing(2),
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
45
58
|
: null}
|
|
46
59
|
<Box sx={{ flexShrink: 0, ml: 2.5 }}>
|
|
47
60
|
<IconButton onClick={handleFirstPageButtonClick} disabled={page === 0} aria-label="first page">
|
|
@@ -3,17 +3,21 @@ import {
|
|
|
3
3
|
ErrorOutlineRounded as ErrorOutlineRoundedIcon,
|
|
4
4
|
WarningAmberRounded as WarningAmberRoundedIcon,
|
|
5
5
|
} from '@mui/icons-material'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import type { TableCellProps, TableRowProps } from '@mui/material'
|
|
7
|
+
import {
|
|
8
|
+
alpha, TableCell, TableRow, Typography,
|
|
9
|
+
} from '@mui/material'
|
|
10
|
+
import type { Hash } from '@xylabs/hex'
|
|
8
11
|
import { usePromise } from '@xylabs/react-promise'
|
|
9
12
|
import { useBreakpoint } from '@xylabs/react-shared'
|
|
10
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
13
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
11
14
|
import { PayloadValidator } from '@xyo-network/payload-validator'
|
|
12
15
|
import { useNetwork } from '@xyo-network/react-network'
|
|
13
16
|
import { HashTableCell, usePayloadHash } from '@xyo-network/react-shared'
|
|
14
17
|
import React, { useMemo } from 'react'
|
|
15
18
|
|
|
16
|
-
import { PayloadTableColumnConfig,
|
|
19
|
+
import type { PayloadTableColumnConfig, PayloadTableColumnSlug } from './PayloadTableColumnConfig.ts'
|
|
20
|
+
import { payloadTableColumnConfigDefaults } from './PayloadTableColumnConfig.ts'
|
|
17
21
|
|
|
18
22
|
export interface PayloadTableRowProps extends TableRowProps {
|
|
19
23
|
archive?: string
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TableRowProps, TypographyProps } from '@mui/material'
|
|
2
|
+
import {
|
|
3
|
+
styled, TableCell, TableRow, Typography,
|
|
4
|
+
} from '@mui/material'
|
|
2
5
|
import React from 'react'
|
|
3
6
|
|
|
4
7
|
export interface TableRowNoDataProps extends TableRowProps {
|
|
@@ -7,7 +10,9 @@ export interface TableRowNoDataProps extends TableRowProps {
|
|
|
7
10
|
typographyProps?: TypographyProps
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
export const TableRowNoData: React.FC<TableRowNoDataProps> = ({
|
|
13
|
+
export const TableRowNoData: React.FC<TableRowNoDataProps> = ({
|
|
14
|
+
additionalCells, hideBorder = false, typographyProps, ...props
|
|
15
|
+
}) => {
|
|
11
16
|
return (
|
|
12
17
|
<TableRow {...props}>
|
|
13
18
|
<StyledTableCell hideBorder={hideBorder}>
|
|
@@ -31,6 +36,4 @@ interface StyledTableCellProps {
|
|
|
31
36
|
const StyledTableCell = styled(TableCell, {
|
|
32
37
|
name: 'StyledTableCell',
|
|
33
38
|
shouldForwardProp: (prop: string) => prop !== 'hideBorder',
|
|
34
|
-
})<StyledTableCellProps>(({ hideBorder }) => ({
|
|
35
|
-
...(hideBorder && { border: 'none' }),
|
|
36
|
-
}))
|
|
39
|
+
})<StyledTableCellProps>(({ hideBorder }) => ({ ...(hideBorder && { border: 'none' }) }))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TableBodyProps, TableRowProps } from '@mui/material'
|
|
2
|
-
import { Hash } from '@xylabs/hex'
|
|
3
|
-
import { WithChildren } from '@xylabs/react-shared'
|
|
4
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
5
|
-
import { ComponentType } from 'react'
|
|
1
|
+
import type { TableBodyProps, TableRowProps } from '@mui/material'
|
|
2
|
+
import type { Hash } from '@xylabs/hex'
|
|
3
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
|
4
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
+
import type { ComponentType } from 'react'
|
|
6
6
|
|
|
7
7
|
export interface PayloadTableBodyProps extends TableBodyProps, WithChildren {
|
|
8
8
|
NoResultRowComponent?: ComponentType<TableRowProps>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TableExVariants } from '@xyo-network/react-table'
|
|
2
|
-
import { ChangeEvent, MouseEvent } from 'react'
|
|
1
|
+
import type { TableExVariants } from '@xyo-network/react-table'
|
|
2
|
+
import type { ChangeEvent, MouseEvent } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface PayloadTableFooterProps {
|
|
5
5
|
count?: number
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TableHeadProps } from '@mui/material'
|
|
1
|
+
import type { TableHeadProps } from '@mui/material'
|
|
2
2
|
|
|
3
|
-
import { PayloadTableColumnConfig, PayloadTableColumnSlug } from '../PayloadTableColumnConfig.ts'
|
|
3
|
+
import type { PayloadTableColumnConfig, PayloadTableColumnSlug } from '../PayloadTableColumnConfig.ts'
|
|
4
4
|
|
|
5
5
|
export interface PayloadTableHeadProps extends TableHeadProps {
|
|
6
6
|
columns?: PayloadTableColumnConfig<PayloadTableColumnSlug>
|
package/xy.config.ts
CHANGED