@xyo-network/react-payload-table 7.0.0 → 7.0.2

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.
@@ -1,9 +1,14 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/components/DynamicTable/DynamicTableRow.tsx
5
- import { CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon, ErrorOutlineRounded as ErrorOutlineRoundedIcon, WarningAmberRounded as WarningAmberRoundedIcon } from "@mui/icons-material";
6
- import { TableCell, TableRow, Typography } from "@mui/material";
2
+ import {
3
+ CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon,
4
+ ErrorOutlineRounded as ErrorOutlineRoundedIcon,
5
+ WarningAmberRounded as WarningAmberRoundedIcon
6
+ } from "@mui/icons-material";
7
+ import {
8
+ TableCell,
9
+ TableRow,
10
+ Typography
11
+ } from "@mui/material";
7
12
  import { usePromise } from "@xylabs/react-promise";
8
13
  import { useBreakpoint } from "@xylabs/react-shared";
9
14
  import { PayloadBuilder } from "@xyo-network/payload-builder";
@@ -11,10 +16,10 @@ import { PayloadValidator } from "@xyo-network/payload-validator";
11
16
  import { useNetwork } from "@xyo-network/react-network";
12
17
  import { usePayloadRenderPluginResolver } from "@xyo-network/react-payload-plugin-resolver";
13
18
  import { HashTableCell, usePayloadHash } from "@xyo-network/react-shared";
14
- import React, { useMemo } from "react";
19
+ import { useMemo } from "react";
15
20
 
16
21
  // src/components/DynamicTable/PayloadDynamicTableColumnConfig.ts
17
- var payloadDynamicTableColumnConfigDefaults = /* @__PURE__ */ __name(() => {
22
+ var payloadDynamicTableColumnConfigDefaults = () => {
18
23
  const xs = [
19
24
  {
20
25
  alignment: "left",
@@ -158,80 +163,45 @@ var payloadDynamicTableColumnConfigDefaults = /* @__PURE__ */ __name(() => {
158
163
  xl,
159
164
  xs
160
165
  };
161
- }, "payloadDynamicTableColumnConfigDefaults");
166
+ };
162
167
 
163
168
  // src/components/DynamicTable/DynamicTableRow.tsx
164
- var PayloadDynamicTableRow = /* @__PURE__ */ __name(({ columns, network: networkProp, payload, ...props }) => {
169
+ import { jsx } from "react/jsx-runtime";
170
+ var PayloadDynamicTableRow = ({
171
+ columns,
172
+ network: networkProp,
173
+ payload,
174
+ ...props
175
+ }) => {
165
176
  const breakPoint = useBreakpoint();
166
177
  const payloadHash = usePayloadHash(payload);
167
178
  const { network } = useNetwork();
168
179
  const { resolver } = usePayloadRenderPluginResolver();
169
- const [validationErrors = []] = usePromise(async () => payload ? await new PayloadValidator(payload).validate() : void 0, [
170
- payload
171
- ]);
180
+ const [validationErrors = []] = usePromise(async () => payload ? await new PayloadValidator(payload).validate() : void 0, [payload]);
172
181
  const isValid = validationErrors.length === 0;
173
182
  const payloadFieldCount = payload ? Object.keys(PayloadBuilder.hashableFields(payload)).length : 0;
174
- const hash = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React.createElement(HashTableCell, {
175
- key: "hash",
176
- align: "left",
177
- value: payloadHash,
178
- dataType: "payload",
179
- network: networkProp ?? network?.slug,
180
- ...props2
181
- }), "hash");
182
- const schema = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React.createElement(TableCell, {
183
- key: "payloads",
184
- align: "left",
185
- ...props2
186
- }, /* @__PURE__ */ React.createElement(Typography, {
187
- fontFamily: "monospace",
188
- variant: "body2",
189
- noWrap: true
190
- }, payload?.schema)), "schema");
191
- const details = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React.createElement(TableCell, {
192
- key: "payloads",
193
- align: "left",
194
- ...props2
195
- }, /* @__PURE__ */ React.createElement(Typography, {
196
- fontFamily: "monospace",
197
- variant: "body2",
198
- noWrap: true
199
- }, payloadFieldCount)), "details");
200
- const render = /* @__PURE__ */ __name((props2) => {
201
- const Render = payload ? resolver?.resolve(payload)?.components.table.cell : void 0;
202
- return Render ? /* @__PURE__ */ React.createElement(Render, {
203
- payload,
204
- ...props2
205
- }) : /* @__PURE__ */ React.createElement(TableCell, {
206
- key: "payloads",
183
+ const hash = (props2) => /* @__PURE__ */ jsx(
184
+ HashTableCell,
185
+ {
207
186
  align: "left",
187
+ value: payloadHash,
188
+ dataType: "payload",
189
+ network: networkProp ?? network?.slug,
208
190
  ...props2
209
- });
210
- }, "render");
211
- const icon = /* @__PURE__ */ __name((props2) => {
191
+ },
192
+ "hash"
193
+ );
194
+ const schema = (props2) => /* @__PURE__ */ jsx(TableCell, { align: "left", ...props2, children: /* @__PURE__ */ jsx(Typography, { fontFamily: "monospace", variant: "body2", noWrap: true, children: payload?.schema }) }, "payloads");
195
+ const details = (props2) => /* @__PURE__ */ jsx(TableCell, { align: "left", ...props2, children: /* @__PURE__ */ jsx(Typography, { fontFamily: "monospace", variant: "body2", noWrap: true, children: payloadFieldCount }) }, "payloads");
196
+ const render = (props2) => {
197
+ const Render = payload ? resolver?.resolve(payload)?.components.table.cell : void 0;
198
+ return Render ? /* @__PURE__ */ jsx(Render, { payload, ...props2 }) : /* @__PURE__ */ jsx(TableCell, { align: "left", ...props2 }, "payloads");
199
+ };
200
+ const icon = (props2) => {
212
201
  const Avatar = payload ? resolver?.resolve(payload)?.components.avatar.image : void 0;
213
- return /* @__PURE__ */ React.createElement(TableCell, {
214
- key: "payloads",
215
- align: "left",
216
- ...props2
217
- }, Avatar ? /* @__PURE__ */ React.createElement(Avatar, {
218
- payload
219
- }) : null);
220
- }, "icon");
221
- const valid = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React.createElement(TableCell, {
222
- key: "valid",
223
- align: "center",
224
- ...props2
225
- }, isValid === void 0 && payload != void 0 ? /* @__PURE__ */ React.createElement(WarningAmberRoundedIcon, {
226
- fontSize: "small",
227
- color: "warning"
228
- }) : isValid === true ? /* @__PURE__ */ React.createElement(CheckCircleOutlineRoundedIcon, {
229
- fontSize: "small",
230
- color: "success"
231
- }) : isValid === false ? /* @__PURE__ */ React.createElement(ErrorOutlineRoundedIcon, {
232
- color: "error",
233
- fontSize: "small"
234
- }) : /* @__PURE__ */ React.createElement(Typography, null, " \xA0")), "valid");
202
+ return /* @__PURE__ */ jsx(TableCell, { align: "left", ...props2, children: Avatar ? /* @__PURE__ */ jsx(Avatar, { payload }) : null }, "payloads");
203
+ };
204
+ const valid = (props2) => /* @__PURE__ */ jsx(TableCell, { align: "center", ...props2, children: isValid === void 0 && payload != void 0 ? /* @__PURE__ */ jsx(WarningAmberRoundedIcon, { fontSize: "small", color: "warning" }) : isValid === true ? /* @__PURE__ */ jsx(CheckCircleOutlineRoundedIcon, { fontSize: "small", color: "success" }) : isValid === false ? /* @__PURE__ */ jsx(ErrorOutlineRoundedIcon, { color: "error", fontSize: "small" }) : /* @__PURE__ */ jsx(Typography, { children: " \xA0" }) }, "valid");
235
205
  const tableCells = {
236
206
  details,
237
207
  hash,
@@ -240,144 +210,142 @@ var PayloadDynamicTableRow = /* @__PURE__ */ __name(({ columns, network: network
240
210
  schema,
241
211
  valid
242
212
  };
243
- const columnsMemo = useMemo(() => columns ?? payloadDynamicTableColumnConfigDefaults(), [
244
- columns
245
- ]);
246
- return breakPoint ? /* @__PURE__ */ React.createElement(TableRow, {
247
- style: {
248
- maxWidth: "100vw"
249
- },
250
- ...props
251
- }, columnsMemo[breakPoint]?.map((column) => {
213
+ const columnsMemo = useMemo(() => columns ?? payloadDynamicTableColumnConfigDefaults(), [columns]);
214
+ return breakPoint ? /* @__PURE__ */ jsx(TableRow, { style: { maxWidth: "100vw" }, ...props, children: columnsMemo[breakPoint]?.map((column) => {
252
215
  return column.slug ? tableCells[column.slug]({}) : null;
253
- })) : null;
254
- }, "PayloadDynamicTableRow");
216
+ }) }) : null;
217
+ };
255
218
 
256
219
  // src/components/DynamicTable/Table.tsx
257
- import { FirstPage as FirstPageIcon, KeyboardArrowLeft, KeyboardArrowRight, LastPage as LastPageIcon } from "@mui/icons-material";
258
- import { Alert, Box, IconButton, Table, TableBody, TableCell as TableCell2, TableFooter, TableHead, TablePagination, TableRow as TableRow2, Typography as Typography2, useTheme } from "@mui/material";
220
+ import {
221
+ FirstPage as FirstPageIcon,
222
+ KeyboardArrowLeft,
223
+ KeyboardArrowRight,
224
+ LastPage as LastPageIcon
225
+ } from "@mui/icons-material";
226
+ import {
227
+ Alert,
228
+ Box,
229
+ IconButton,
230
+ Table,
231
+ TableBody,
232
+ TableCell as TableCell2,
233
+ TableFooter,
234
+ TableHead,
235
+ TablePagination,
236
+ TableRow as TableRow2,
237
+ Typography as Typography2,
238
+ useTheme
239
+ } from "@mui/material";
259
240
  import { ThrownErrorBoundary } from "@xylabs/react-error";
260
241
  import { useResetState } from "@xylabs/react-hooks";
261
242
  import { useBreakpoint as useBreakpoint2 } from "@xylabs/react-shared";
262
243
  import { usePayloadHashes } from "@xyo-network/react-shared";
263
- import React2, { useMemo as useMemo2, useState } from "react";
264
- var TablePaginationActions = /* @__PURE__ */ __name((props) => {
244
+ import { useMemo as useMemo2, useState } from "react";
245
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
246
+ var TablePaginationActions = (props) => {
265
247
  const theme = useTheme();
266
- const { count, page, rowsPerPage, onPageChange } = props;
267
- const handleFirstPageButtonClick = /* @__PURE__ */ __name((event) => {
248
+ const {
249
+ count,
250
+ page,
251
+ rowsPerPage,
252
+ onPageChange
253
+ } = props;
254
+ const handleFirstPageButtonClick = (event) => {
268
255
  onPageChange(event, 0);
269
- }, "handleFirstPageButtonClick");
270
- const handleBackButtonClick = /* @__PURE__ */ __name((event) => {
256
+ };
257
+ const handleBackButtonClick = (event) => {
271
258
  onPageChange(event, page - 1);
272
- }, "handleBackButtonClick");
273
- const handleNextButtonClick = /* @__PURE__ */ __name((event) => {
259
+ };
260
+ const handleNextButtonClick = (event) => {
274
261
  onPageChange(event, page + 1);
275
- }, "handleNextButtonClick");
276
- const handleLastPageButtonClick = /* @__PURE__ */ __name((event) => {
262
+ };
263
+ const handleLastPageButtonClick = (event) => {
277
264
  onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
278
- }, "handleLastPageButtonClick");
279
- return /* @__PURE__ */ React2.createElement(Box, {
280
- sx: {
281
- flexShrink: 0,
282
- ml: 2.5
283
- }
284
- }, /* @__PURE__ */ React2.createElement(IconButton, {
285
- onClick: handleFirstPageButtonClick,
286
- disabled: page === 0,
287
- "aria-label": "first page"
288
- }, theme.direction === "rtl" ? /* @__PURE__ */ React2.createElement(LastPageIcon, null) : /* @__PURE__ */ React2.createElement(FirstPageIcon, null)), /* @__PURE__ */ React2.createElement(IconButton, {
289
- onClick: handleBackButtonClick,
290
- disabled: page === 0,
291
- "aria-label": "previous page"
292
- }, theme.direction === "rtl" ? /* @__PURE__ */ React2.createElement(KeyboardArrowRight, null) : /* @__PURE__ */ React2.createElement(KeyboardArrowLeft, null)), /* @__PURE__ */ React2.createElement(IconButton, {
293
- onClick: handleNextButtonClick,
294
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
295
- "aria-label": "next page"
296
- }, theme.direction === "rtl" ? /* @__PURE__ */ React2.createElement(KeyboardArrowLeft, null) : /* @__PURE__ */ React2.createElement(KeyboardArrowRight, null)), /* @__PURE__ */ React2.createElement(IconButton, {
297
- onClick: handleLastPageButtonClick,
298
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
299
- "aria-label": "last page"
300
- }, theme.direction === "rtl" ? /* @__PURE__ */ React2.createElement(FirstPageIcon, null) : /* @__PURE__ */ React2.createElement(LastPageIcon, null)));
301
- }, "TablePaginationActions");
302
- var PayloadDynamicTable = /* @__PURE__ */ __name(({ archive, children, columns, exploreDomain, onRowClick, rowsPerPage: rowsPerPageProp = 10, payloads, ...props }) => {
265
+ };
266
+ return /* @__PURE__ */ jsxs(Box, { sx: { flexShrink: 0, ml: 2.5 }, children: [
267
+ /* @__PURE__ */ jsx2(IconButton, { onClick: handleFirstPageButtonClick, disabled: page === 0, "aria-label": "first page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx2(LastPageIcon, {}) : /* @__PURE__ */ jsx2(FirstPageIcon, {}) }),
268
+ /* @__PURE__ */ jsx2(IconButton, { onClick: handleBackButtonClick, disabled: page === 0, "aria-label": "previous page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx2(KeyboardArrowRight, {}) : /* @__PURE__ */ jsx2(KeyboardArrowLeft, {}) }),
269
+ /* @__PURE__ */ jsx2(IconButton, { onClick: handleNextButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "next page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx2(KeyboardArrowLeft, {}) : /* @__PURE__ */ jsx2(KeyboardArrowRight, {}) }),
270
+ /* @__PURE__ */ jsx2(IconButton, { onClick: handleLastPageButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "last page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx2(FirstPageIcon, {}) : /* @__PURE__ */ jsx2(LastPageIcon, {}) })
271
+ ] });
272
+ };
273
+ var PayloadDynamicTable = ({
274
+ archive,
275
+ children,
276
+ columns,
277
+ exploreDomain,
278
+ onRowClick,
279
+ rowsPerPage: rowsPerPageProp = 10,
280
+ payloads,
281
+ ...props
282
+ }) => {
303
283
  const breakPoint = useBreakpoint2();
304
284
  const [page, setPage] = useState(0);
305
285
  const [rowsPerPage, setRowsPerPage] = useResetState(rowsPerPageProp);
306
286
  const payloadCount = payloads ? payloads.length : 0;
307
287
  const emptyRows = page > 0 ? Math.max(0, (1 + page) * rowsPerPage - payloadCount) : 0;
308
- const pagedPayloads = useMemo2(() => payloads?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage), [
309
- payloads,
310
- page,
311
- rowsPerPage
312
- ]);
288
+ const pagedPayloads = useMemo2(() => payloads?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage), [payloads, page, rowsPerPage]);
313
289
  const payloadPairs = usePayloadHashes(pagedPayloads);
314
- const handleChangePage = /* @__PURE__ */ __name((event, newPage) => {
290
+ const handleChangePage = (event, newPage) => {
315
291
  setPage(newPage);
316
- }, "handleChangePage");
317
- const handleChangeRowsPerPage = /* @__PURE__ */ __name((event) => {
292
+ };
293
+ const handleChangeRowsPerPage = (event) => {
318
294
  setRowsPerPage(Number.parseInt(event.target.value, 10));
319
295
  setPage(0);
320
- }, "handleChangeRowsPerPage");
321
- return breakPoint ? /* @__PURE__ */ React2.createElement(Table, {
322
- stickyHeader: true,
323
- ...props
324
- }, /* @__PURE__ */ React2.createElement(TableHead, null, /* @__PURE__ */ React2.createElement(TableRow2, null, (columns ?? payloadDynamicTableColumnConfigDefaults())[breakPoint]?.map((column, index) => {
325
- return /* @__PURE__ */ React2.createElement(TableCell2, {
326
- key: index,
327
- align: column.alignment ?? "left",
328
- width: column.width
329
- }, /* @__PURE__ */ React2.createElement(Typography2, {
330
- variant: "body2",
331
- noWrap: true
332
- }, column.name));
333
- }))), /* @__PURE__ */ React2.createElement(TableBody, {
334
- sx: {
335
- overflowY: "scroll "
336
- }
337
- }, payloadPairs?.map(([payload, hash], index) => {
338
- return /* @__PURE__ */ React2.createElement(ThrownErrorBoundary, {
339
- boundaryName: "PayloadTableBody",
340
- key: `${hash}-${index}`,
341
- errorComponent: /* @__PURE__ */ __name((e) => /* @__PURE__ */ React2.createElement(Alert, {
342
- severity: "error"
343
- }, "Error Loading Payload:", " ", /* @__PURE__ */ React2.createElement(Typography2, {
344
- fontWeight: "bold"
345
- }, e.message)), "errorComponent")
346
- }, /* @__PURE__ */ React2.createElement(PayloadDynamicTableRow, {
347
- archive,
348
- onClick: onRowClick ? () => {
349
- onRowClick(payload);
350
- } : void 0,
351
- exploreDomain,
352
- payload
353
- }));
354
- }), children, emptyRows ? Array.from({
355
- length: emptyRows
356
- }).fill(/* @__PURE__ */ React2.createElement(PayloadDynamicTableRow, null)) : null), /* @__PURE__ */ React2.createElement(TableFooter, null, /* @__PURE__ */ React2.createElement(TableRow2, null, /* @__PURE__ */ React2.createElement(TablePagination, {
357
- rowsPerPageOptions: [
358
- 5,
359
- 10,
360
- 25,
296
+ };
297
+ return breakPoint ? /* @__PURE__ */ jsxs(Table, { stickyHeader: true, ...props, children: [
298
+ /* @__PURE__ */ jsx2(TableHead, { children: /* @__PURE__ */ jsx2(TableRow2, { children: (columns ?? payloadDynamicTableColumnConfigDefaults())[breakPoint]?.map((column, index) => {
299
+ return /* @__PURE__ */ jsx2(TableCell2, { align: column.alignment ?? "left", width: column.width, children: /* @__PURE__ */ jsx2(Typography2, { variant: "body2", noWrap: true, children: column.name }) }, index);
300
+ }) }) }),
301
+ /* @__PURE__ */ jsxs(TableBody, { sx: { overflowY: "scroll " }, children: [
302
+ payloadPairs?.map(([payload, hash], index) => {
303
+ return /* @__PURE__ */ jsx2(
304
+ ThrownErrorBoundary,
305
+ {
306
+ boundaryName: "PayloadTableBody",
307
+ errorComponent: (e) => /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
308
+ "Error Loading Payload:",
309
+ " ",
310
+ /* @__PURE__ */ jsx2(Typography2, { fontWeight: "bold", children: e.message })
311
+ ] }),
312
+ children: /* @__PURE__ */ jsx2(
313
+ PayloadDynamicTableRow,
314
+ {
315
+ archive,
316
+ onClick: onRowClick ? () => {
317
+ onRowClick(payload);
318
+ } : void 0,
319
+ exploreDomain,
320
+ payload
321
+ }
322
+ )
323
+ },
324
+ `${hash}-${index}`
325
+ );
326
+ }),
327
+ children,
328
+ emptyRows ? Array.from({ length: emptyRows }).fill(/* @__PURE__ */ jsx2(PayloadDynamicTableRow, {})) : null
329
+ ] }),
330
+ /* @__PURE__ */ jsx2(TableFooter, { children: /* @__PURE__ */ jsx2(TableRow2, { children: /* @__PURE__ */ jsx2(
331
+ TablePagination,
361
332
  {
362
- label: "All",
363
- value: -1
333
+ rowsPerPageOptions: [5, 10, 25, { label: "All", value: -1 }],
334
+ colSpan: 5,
335
+ count: payloadCount,
336
+ rowsPerPage,
337
+ page,
338
+ SelectProps: {
339
+ inputProps: { "aria-label": "rows per page" },
340
+ native: true
341
+ },
342
+ onPageChange: handleChangePage,
343
+ onRowsPerPageChange: handleChangeRowsPerPage,
344
+ ActionsComponent: TablePaginationActions
364
345
  }
365
- ],
366
- colSpan: 5,
367
- count: payloadCount,
368
- rowsPerPage,
369
- page,
370
- SelectProps: {
371
- inputProps: {
372
- "aria-label": "rows per page"
373
- },
374
- native: true
375
- },
376
- onPageChange: handleChangePage,
377
- onRowsPerPageChange: handleChangeRowsPerPage,
378
- ActionsComponent: TablePaginationActions
379
- })))) : null;
380
- }, "PayloadDynamicTable");
346
+ ) }) })
347
+ ] }) : null;
348
+ };
381
349
 
382
350
  // src/components/Table/PayloadTableColumnConfig.ts
383
351
  var payloadColumnNames = {
@@ -385,32 +353,12 @@ var payloadColumnNames = {
385
353
  schema: "Schema",
386
354
  valid: "Valid"
387
355
  };
388
- var payloadTableColumnConfigDefaults = /* @__PURE__ */ __name(() => {
389
- const xs = [
390
- "hash",
391
- "schema",
392
- "valid"
393
- ];
394
- const sm = [
395
- "hash",
396
- "schema",
397
- "valid"
398
- ];
399
- const md = [
400
- "hash",
401
- "schema",
402
- "valid"
403
- ];
404
- const lg = [
405
- "hash",
406
- "schema",
407
- "valid"
408
- ];
409
- const xl = [
410
- "hash",
411
- "schema",
412
- "valid"
413
- ];
356
+ var payloadTableColumnConfigDefaults = () => {
357
+ const xs = ["hash", "schema", "valid"];
358
+ const sm = ["hash", "schema", "valid"];
359
+ const md = ["hash", "schema", "valid"];
360
+ const lg = ["hash", "schema", "valid"];
361
+ const xl = ["hash", "schema", "valid"];
414
362
  return {
415
363
  lg,
416
364
  md,
@@ -418,314 +366,333 @@ var payloadTableColumnConfigDefaults = /* @__PURE__ */ __name(() => {
418
366
  xl,
419
367
  xs
420
368
  };
421
- }, "payloadTableColumnConfigDefaults");
369
+ };
422
370
 
423
371
  // src/components/Table/Table.tsx
424
372
  import { TableEx } from "@xyo-network/react-table";
425
- import React9, { useMemo as useMemo5, useState as useState2 } from "react";
373
+ import { useMemo as useMemo5, useState as useState2 } from "react";
426
374
 
427
375
  // src/components/Table/TableBody.tsx
428
- import { Alert as Alert2, TableBody as TableBody2, Typography as Typography4 } from "@mui/material";
376
+ import {
377
+ Alert as Alert2,
378
+ TableBody as TableBody2,
379
+ Typography as Typography4
380
+ } from "@mui/material";
429
381
  import { ThrownErrorBoundary as ThrownErrorBoundary2 } from "@xylabs/react-error";
430
382
  import { usePayloadHashes as usePayloadHashes2 } from "@xyo-network/react-shared";
431
- import React4 from "react";
432
383
 
433
384
  // src/components/Table/TableRow.tsx
434
- import { CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon2, ErrorOutlineRounded as ErrorOutlineRoundedIcon2, WarningAmberRounded as WarningAmberRoundedIcon2 } from "@mui/icons-material";
435
- import { alpha, Link, TableCell as TableCell3, TableRow as TableRow3, Typography as Typography3 } from "@mui/material";
385
+ import {
386
+ CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon2,
387
+ ErrorOutlineRounded as ErrorOutlineRoundedIcon2,
388
+ WarningAmberRounded as WarningAmberRoundedIcon2
389
+ } from "@mui/icons-material";
390
+ import {
391
+ alpha,
392
+ Link,
393
+ TableCell as TableCell3,
394
+ TableRow as TableRow3,
395
+ Typography as Typography3
396
+ } from "@mui/material";
436
397
  import { usePromise as usePromise2 } from "@xylabs/react-promise";
437
398
  import { useBreakpoint as useBreakpoint3 } from "@xylabs/react-shared";
438
399
  import { isDefined } from "@xylabs/typeof";
439
400
  import { PayloadValidator as PayloadValidator2 } from "@xyo-network/payload-validator";
440
401
  import { useEvent } from "@xyo-network/react-event";
441
402
  import { HashTableCell as HashTableCell2, usePayloadHash as usePayloadHash2 } from "@xyo-network/react-shared";
442
- import React3, { useMemo as useMemo3 } from "react";
443
- var PayloadTableRow = /* @__PURE__ */ __name(({ clickableFields, columns, maxSchemaDepth, network: networkProp, onHashClick, payload, ...props }) => {
403
+ import { useMemo as useMemo3 } from "react";
404
+ import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
405
+ var PayloadTableRow = ({
406
+ clickableFields,
407
+ columns,
408
+ maxSchemaDepth,
409
+ network: networkProp,
410
+ onHashClick,
411
+ payload,
412
+ ...props
413
+ }) => {
444
414
  const breakPoint = useBreakpoint3();
445
415
  const payloadHash = usePayloadHash2(payload);
446
416
  const [anchorRef, dispatch] = useEvent();
447
- const [errors = []] = usePromise2(async () => payload ? await new PayloadValidator2(payload).validate() : void 0, [
448
- payload
449
- ]);
417
+ const [errors = []] = usePromise2(async () => payload ? await new PayloadValidator2(payload).validate() : void 0, [payload]);
450
418
  const isValid = errors.length === 0;
451
- const hash = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React3.createElement(HashTableCell2, {
452
- dataType: "payload",
453
- key: "hash",
454
- onHashClick,
455
- value: payloadHash,
456
- width: "100%",
457
- ...props2
458
- }, isDefined(payloadHash) && /* @__PURE__ */ React3.createElement(React3.Fragment, null, clickableFields?.includes("hash") ? /* @__PURE__ */ React3.createElement(Link, {
459
- onClick: /* @__PURE__ */ __name(() => dispatch("hash", "click", payloadHash), "onClick"),
460
- ref: anchorRef,
461
- sx: {
462
- cursor: "pointer"
463
- }
464
- }, payloadHash) : payloadHash)), "hash");
465
- const reduceSchemaDepth = /* @__PURE__ */ __name((schema2, maxSchemaDepth2) => {
419
+ const hash = (props2) => /* @__PURE__ */ jsx3(
420
+ HashTableCell2,
421
+ {
422
+ dataType: "payload",
423
+ onHashClick,
424
+ value: payloadHash,
425
+ width: "100%",
426
+ ...props2,
427
+ children: isDefined(payloadHash) && /* @__PURE__ */ jsx3(Fragment, { children: clickableFields?.includes("hash") ? /* @__PURE__ */ jsx3(Link, { onClick: () => dispatch("hash", "click", payloadHash), ref: anchorRef, sx: { cursor: "pointer" }, children: payloadHash }) : payloadHash })
428
+ },
429
+ "hash"
430
+ );
431
+ const reduceSchemaDepth = (schema2, maxSchemaDepth2) => {
466
432
  if (isDefined(maxSchemaDepth2)) {
467
433
  const parts = schema2?.split(".") ?? [];
468
434
  const partsToRemove = Math.max(parts.length - maxSchemaDepth2, 0);
469
435
  if (partsToRemove > 0) {
470
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(React3.Fragment, null, "\u2026"), `${parts.slice(partsToRemove).reduce((previousValue, part) => previousValue + "." + part, "")}`);
436
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
437
+ /* @__PURE__ */ jsx3(Fragment, { children: "\u2026" }),
438
+ `${parts.slice(partsToRemove).reduce((previousValue, part) => previousValue + "." + part, "")}`
439
+ ] });
471
440
  }
472
441
  }
473
442
  return schema2;
474
- }, "reduceSchemaDepth");
475
- const schema = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React3.createElement(TableCell3, {
476
- title: payload?.schema,
477
- key: "payloads",
478
- align: "center",
479
- ...props2
480
- }, /* @__PURE__ */ React3.createElement(Typography3, {
481
- fontFamily: "monospace",
482
- variant: "body2",
483
- noWrap: true
484
- }, clickableFields?.includes("schema") ? /* @__PURE__ */ React3.createElement(Link, {
485
- sx: {
486
- cursor: "pointer"
487
- }
488
- }, reduceSchemaDepth(payload?.schema, maxSchemaDepth)) : reduceSchemaDepth(payload?.schema, maxSchemaDepth))), "schema");
489
- const valid = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React3.createElement(TableCell3, {
490
- key: "valid",
491
- align: "center",
492
- ...props2
493
- }, isValid === void 0 && payload != void 0 ? /* @__PURE__ */ React3.createElement(WarningAmberRoundedIcon2, {
494
- fontSize: "small",
495
- color: "warning"
496
- }) : isValid === true ? /* @__PURE__ */ React3.createElement(CheckCircleOutlineRoundedIcon2, {
497
- fontSize: "small",
498
- color: "success"
499
- }) : isValid === false ? /* @__PURE__ */ React3.createElement(ErrorOutlineRoundedIcon2, {
500
- color: "error",
501
- fontSize: "small"
502
- }) : /* @__PURE__ */ React3.createElement(ErrorOutlineRoundedIcon2, {
503
- sx: {
504
- color: alpha("#fff", 0)
505
- },
506
- fontSize: "small"
507
- })), "valid");
443
+ };
444
+ const schema = (props2) => /* @__PURE__ */ jsx3(TableCell3, { title: payload?.schema, align: "center", ...props2, children: /* @__PURE__ */ jsx3(Typography3, { fontFamily: "monospace", variant: "body2", noWrap: true, children: clickableFields?.includes("schema") ? /* @__PURE__ */ jsx3(Link, { sx: { cursor: "pointer" }, children: reduceSchemaDepth(payload?.schema, maxSchemaDepth) }) : reduceSchemaDepth(payload?.schema, maxSchemaDepth) }) }, "payloads");
445
+ const valid = (props2) => /* @__PURE__ */ jsx3(TableCell3, { align: "center", ...props2, children: isValid === void 0 && payload != void 0 ? /* @__PURE__ */ jsx3(WarningAmberRoundedIcon2, { fontSize: "small", color: "warning" }) : isValid === true ? /* @__PURE__ */ jsx3(CheckCircleOutlineRoundedIcon2, { fontSize: "small", color: "success" }) : isValid === false ? /* @__PURE__ */ jsx3(ErrorOutlineRoundedIcon2, { color: "error", fontSize: "small" }) : /* @__PURE__ */ jsx3(ErrorOutlineRoundedIcon2, { sx: { color: alpha("#fff", 0) }, fontSize: "small" }) }, "valid");
508
446
  const tableCells = {
509
447
  hash,
510
448
  schema,
511
449
  valid
512
450
  };
513
- const columnsMemo = useMemo3(() => columns ?? payloadTableColumnConfigDefaults(), [
514
- columns
515
- ]);
516
- return isDefined(breakPoint) ? /* @__PURE__ */ React3.createElement(TableRow3, {
517
- style: {
518
- maxWidth: "100vw"
519
- },
520
- ...props
521
- }, columnsMemo[breakPoint]?.map((column) => {
451
+ const columnsMemo = useMemo3(() => columns ?? payloadTableColumnConfigDefaults(), [columns]);
452
+ return isDefined(breakPoint) ? /* @__PURE__ */ jsx3(TableRow3, { style: { maxWidth: "100vw" }, ...props, children: columnsMemo[breakPoint]?.map((column) => {
522
453
  return tableCells[column]({});
523
- })) : null;
524
- }, "PayloadTableRow");
454
+ }) }) : null;
455
+ };
525
456
 
526
457
  // src/components/Table/TableBody.tsx
527
- var PayloadTableBody = /* @__PURE__ */ __name(({ children, clickableFields, payloads, maxSchemaDepth, onHashClick, onRowClick, emptyRows, noResults, NoResultRowComponent, ...props }) => {
458
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
459
+ var PayloadTableBody = ({
460
+ children,
461
+ clickableFields,
462
+ payloads,
463
+ maxSchemaDepth,
464
+ onHashClick,
465
+ onRowClick,
466
+ emptyRows,
467
+ noResults,
468
+ NoResultRowComponent,
469
+ ...props
470
+ }) => {
528
471
  const payloadPairs = usePayloadHashes2(payloads);
529
- return /* @__PURE__ */ React4.createElement(TableBody2, props, noResults && NoResultRowComponent ? /* @__PURE__ */ React4.createElement(NoResultRowComponent, null) : null, payloadPairs?.map(([payload, hash], index) => {
530
- return /* @__PURE__ */ React4.createElement(ThrownErrorBoundary2, {
531
- boundaryName: "PayloadTableBody",
532
- key: `${hash}-${index}`,
533
- errorComponent: /* @__PURE__ */ __name((e) => /* @__PURE__ */ React4.createElement(Alert2, {
534
- severity: "error"
535
- }, "Error Loading Payload:", " ", /* @__PURE__ */ React4.createElement(Typography4, {
536
- fontWeight: "bold"
537
- }, e.message)), "errorComponent")
538
- }, /* @__PURE__ */ React4.createElement(PayloadTableRow, {
539
- clickableFields,
540
- maxSchemaDepth,
541
- onClick: onRowClick ? () => {
542
- onRowClick(payload);
543
- } : void 0,
544
- onHashClick,
545
- payload
546
- }));
547
- }), children, emptyRows ? Array.from({
548
- length: emptyRows
549
- }).fill(/* @__PURE__ */ React4.createElement(PayloadTableRow, null)) : null);
550
- }, "PayloadTableBody");
472
+ return /* @__PURE__ */ jsxs3(TableBody2, { ...props, children: [
473
+ noResults && NoResultRowComponent ? /* @__PURE__ */ jsx4(NoResultRowComponent, {}) : null,
474
+ payloadPairs?.map(([payload, hash], index) => {
475
+ return /* @__PURE__ */ jsx4(
476
+ ThrownErrorBoundary2,
477
+ {
478
+ boundaryName: "PayloadTableBody",
479
+ errorComponent: (e) => /* @__PURE__ */ jsxs3(Alert2, { severity: "error", children: [
480
+ "Error Loading Payload:",
481
+ " ",
482
+ /* @__PURE__ */ jsx4(Typography4, { fontWeight: "bold", children: e.message })
483
+ ] }),
484
+ children: /* @__PURE__ */ jsx4(
485
+ PayloadTableRow,
486
+ {
487
+ clickableFields,
488
+ maxSchemaDepth,
489
+ onClick: onRowClick ? () => {
490
+ onRowClick(payload);
491
+ } : void 0,
492
+ onHashClick,
493
+ payload
494
+ }
495
+ )
496
+ },
497
+ `${hash}-${index}`
498
+ );
499
+ }),
500
+ children,
501
+ emptyRows ? Array.from({ length: emptyRows }).fill(/* @__PURE__ */ jsx4(PayloadTableRow, {})) : null
502
+ ] });
503
+ };
551
504
 
552
505
  // src/components/Table/TableFooter.tsx
553
- import { styled, TablePagination as TablePagination2, TableRow as TableRow4 } from "@mui/material";
506
+ import {
507
+ styled,
508
+ TablePagination as TablePagination2,
509
+ TableRow as TableRow4
510
+ } from "@mui/material";
554
511
  import { TableFooterEx } from "@xyo-network/react-table";
555
- import React6 from "react";
556
512
 
557
513
  // src/components/Table/TablePagination.tsx
558
- import { FirstPage as FirstPageIcon2, KeyboardArrowLeft as KeyboardArrowLeft2, KeyboardArrowRight as KeyboardArrowRight2, LastPage as LastPageIcon2 } from "@mui/icons-material";
559
- import { Box as Box2, CircularProgress, IconButton as IconButton2, useTheme as useTheme2 } from "@mui/material";
514
+ import {
515
+ FirstPage as FirstPageIcon2,
516
+ KeyboardArrowLeft as KeyboardArrowLeft2,
517
+ KeyboardArrowRight as KeyboardArrowRight2,
518
+ LastPage as LastPageIcon2
519
+ } from "@mui/icons-material";
520
+ import {
521
+ Box as Box2,
522
+ CircularProgress,
523
+ IconButton as IconButton2,
524
+ useTheme as useTheme2
525
+ } from "@mui/material";
560
526
  import { useEvent as useEvent2 } from "@xyo-network/react-event";
561
- import React5 from "react";
562
- function TablePaginationActions2({ count, enableNextPage, loading, onPageChange, page, rowsPerPage }) {
527
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
528
+ function TablePaginationActions2({
529
+ count,
530
+ enableNextPage,
531
+ loading,
532
+ onPageChange,
533
+ page,
534
+ rowsPerPage
535
+ }) {
563
536
  const theme = useTheme2();
564
537
  const [paginationRef, paginationDispatch] = useEvent2();
565
- const handleFirstPageButtonClick = /* @__PURE__ */ __name((event) => {
538
+ const handleFirstPageButtonClick = (event) => {
566
539
  paginationDispatch("firstPage", "click", "true");
567
540
  onPageChange(event, 0);
568
- }, "handleFirstPageButtonClick");
569
- const handleBackButtonClick = /* @__PURE__ */ __name((event) => {
541
+ };
542
+ const handleBackButtonClick = (event) => {
570
543
  paginationDispatch("previousPage", "click", (page - 1)?.toString());
571
544
  onPageChange(event, page - 1);
572
- }, "handleBackButtonClick");
573
- const handleNextButtonClick = /* @__PURE__ */ __name((event) => {
545
+ };
546
+ const handleNextButtonClick = (event) => {
574
547
  paginationDispatch("nextPage", "click", (page + 1)?.toString());
575
548
  onPageChange(event, page + 1);
576
- }, "handleNextButtonClick");
577
- const handleLastPageButtonClick = /* @__PURE__ */ __name((event) => {
549
+ };
550
+ const handleLastPageButtonClick = (event) => {
578
551
  paginationDispatch("lastPage", "click", "true");
579
552
  onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
580
- }, "handleLastPageButtonClick");
581
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, loading ? /* @__PURE__ */ React5.createElement(CircularProgress, {
582
- size: "small",
583
- sx: {
584
- height: theme.spacing(2),
585
- position: "absolute",
586
- width: theme.spacing(2)
587
- }
588
- }) : null, /* @__PURE__ */ React5.createElement(Box2, {
589
- sx: {
590
- flexShrink: 0,
591
- ml: 2.5
592
- }
593
- }, /* @__PURE__ */ React5.createElement(IconButton2, {
594
- onClick: handleFirstPageButtonClick,
595
- disabled: page === 0,
596
- "aria-label": "first page"
597
- }, theme.direction === "rtl" ? /* @__PURE__ */ React5.createElement(LastPageIcon2, null) : /* @__PURE__ */ React5.createElement(FirstPageIcon2, null)), /* @__PURE__ */ React5.createElement(IconButton2, {
598
- ref: paginationRef,
599
- onClick: handleBackButtonClick,
600
- disabled: page === 0,
601
- "aria-label": "previous page"
602
- }, theme.direction === "rtl" ? /* @__PURE__ */ React5.createElement(KeyboardArrowRight2, null) : /* @__PURE__ */ React5.createElement(KeyboardArrowLeft2, null)), /* @__PURE__ */ React5.createElement(IconButton2, {
603
- ref: paginationRef,
604
- onClick: handleNextButtonClick,
605
- disabled: !enableNextPage && page >= Math.ceil(count / rowsPerPage) - 1,
606
- "aria-label": "next page"
607
- }, theme.direction === "rtl" ? /* @__PURE__ */ React5.createElement(KeyboardArrowLeft2, null) : /* @__PURE__ */ React5.createElement(KeyboardArrowRight2, null)), /* @__PURE__ */ React5.createElement(IconButton2, {
608
- onClick: handleLastPageButtonClick,
609
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
610
- "aria-label": "last page"
611
- }, theme.direction === "rtl" ? /* @__PURE__ */ React5.createElement(FirstPageIcon2, null) : /* @__PURE__ */ React5.createElement(LastPageIcon2, null))));
553
+ };
554
+ return /* @__PURE__ */ jsxs4(Fragment2, { children: [
555
+ loading ? /* @__PURE__ */ jsx5(
556
+ CircularProgress,
557
+ {
558
+ size: "small",
559
+ sx: {
560
+ height: theme.spacing(2),
561
+ position: "absolute",
562
+ width: theme.spacing(2)
563
+ }
564
+ }
565
+ ) : null,
566
+ /* @__PURE__ */ jsxs4(Box2, { sx: { flexShrink: 0, ml: 2.5 }, children: [
567
+ /* @__PURE__ */ jsx5(IconButton2, { onClick: handleFirstPageButtonClick, disabled: page === 0, "aria-label": "first page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx5(LastPageIcon2, {}) : /* @__PURE__ */ jsx5(FirstPageIcon2, {}) }),
568
+ /* @__PURE__ */ jsx5(IconButton2, { ref: paginationRef, onClick: handleBackButtonClick, disabled: page === 0, "aria-label": "previous page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx5(KeyboardArrowRight2, {}) : /* @__PURE__ */ jsx5(KeyboardArrowLeft2, {}) }),
569
+ /* @__PURE__ */ jsx5(
570
+ IconButton2,
571
+ {
572
+ ref: paginationRef,
573
+ onClick: handleNextButtonClick,
574
+ disabled: !enableNextPage && page >= Math.ceil(count / rowsPerPage) - 1,
575
+ "aria-label": "next page",
576
+ children: theme.direction === "rtl" ? /* @__PURE__ */ jsx5(KeyboardArrowLeft2, {}) : /* @__PURE__ */ jsx5(KeyboardArrowRight2, {})
577
+ }
578
+ ),
579
+ /* @__PURE__ */ jsx5(IconButton2, { onClick: handleLastPageButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "last page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx5(FirstPageIcon2, {}) : /* @__PURE__ */ jsx5(LastPageIcon2, {}) })
580
+ ] })
581
+ ] });
612
582
  }
613
- __name(TablePaginationActions2, "TablePaginationActions");
614
583
 
615
584
  // src/components/Table/TableFooter.tsx
616
- var PayloadTableFooter = /* @__PURE__ */ __name(({ count, variant, page, rowsPerPage, handleChangePage, handleChangeRowsPerPage, fetchMorePayloads, loading }) => /* @__PURE__ */ React6.createElement(TableFooterEx, {
617
- variant
618
- }, /* @__PURE__ */ React6.createElement(TableRow4, null, /* @__PURE__ */ React6.createElement(StyledTablePagination, {
619
- rowsPerPageOptions: [
620
- 5,
621
- 10,
622
- 25,
623
- {
624
- label: "All",
625
- value: -1
626
- }
627
- ],
628
- count: count ?? 0,
629
- rowsPerPage: rowsPerPage ?? 10,
630
- page: page ?? 0,
631
- SelectProps: {
632
- inputProps: {
633
- "aria-label": "rows per page"
585
+ import { jsx as jsx6 } from "react/jsx-runtime";
586
+ var PayloadTableFooter = ({
587
+ count,
588
+ variant,
589
+ page,
590
+ rowsPerPage,
591
+ handleChangePage,
592
+ handleChangeRowsPerPage,
593
+ fetchMorePayloads,
594
+ loading
595
+ }) => /* @__PURE__ */ jsx6(TableFooterEx, { variant, children: /* @__PURE__ */ jsx6(TableRow4, { children: /* @__PURE__ */ jsx6(
596
+ StyledTablePagination,
597
+ {
598
+ rowsPerPageOptions: [5, 10, 25, { label: "All", value: -1 }],
599
+ count: count ?? 0,
600
+ rowsPerPage: rowsPerPage ?? 10,
601
+ page: page ?? 0,
602
+ SelectProps: {
603
+ inputProps: { "aria-label": "rows per page" },
604
+ native: true
634
605
  },
635
- native: true
636
- },
637
- onPageChange: handleChangePage ?? (() => {
638
- }),
639
- onRowsPerPageChange: handleChangeRowsPerPage ?? (() => {
640
- }),
641
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
642
- ActionsComponent: /* @__PURE__ */ __name((props) => /* @__PURE__ */ React6.createElement(TablePaginationActions2, {
643
- enableNextPage: !!fetchMorePayloads,
644
- loading,
645
- ...props
646
- }), "ActionsComponent")
647
- }))), "PayloadTableFooter");
606
+ onPageChange: handleChangePage ?? (() => {
607
+ }),
608
+ onRowsPerPageChange: handleChangeRowsPerPage ?? (() => {
609
+ }),
610
+ ActionsComponent: (props) => /* @__PURE__ */ jsx6(TablePaginationActions2, { enableNextPage: !!fetchMorePayloads, loading, ...props })
611
+ }
612
+ ) }) });
648
613
  var StyledTablePagination = styled(TablePagination2)(({ theme }) => ({
649
- "& > .MuiToolbar-root": {
650
- paddingLeft: theme.spacing(1)
651
- },
614
+ "& > .MuiToolbar-root": { paddingLeft: theme.spacing(1) },
652
615
  "borderTop": "1px solid",
653
616
  "borderTopColor": theme.vars.palette.divider
654
617
  }));
655
618
 
656
619
  // src/components/Table/TableHead.tsx
657
- import { TableCell as TableCell4, TableHead as TableHead2, TableRow as TableRow5, Typography as Typography5 } from "@mui/material";
620
+ import {
621
+ TableCell as TableCell4,
622
+ TableHead as TableHead2,
623
+ TableRow as TableRow5,
624
+ Typography as Typography5
625
+ } from "@mui/material";
658
626
  import { useBreakpoint as useBreakpoint4 } from "@xylabs/react-shared";
659
- import React7, { useMemo as useMemo4 } from "react";
660
- var PayloadTableHead = /* @__PURE__ */ __name(({ columns, ...props }) => {
627
+ import { useMemo as useMemo4 } from "react";
628
+ import { jsx as jsx7 } from "react/jsx-runtime";
629
+ var PayloadTableHead = ({ columns, ...props }) => {
661
630
  const breakPoint = useBreakpoint4();
662
- const columnsMemo = useMemo4(() => columns ?? payloadTableColumnConfigDefaults(), [
663
- columns
664
- ]);
665
- return /* @__PURE__ */ React7.createElement(TableHead2, props, /* @__PURE__ */ React7.createElement(TableRow5, null, breakPoint ? columnsMemo[breakPoint]?.map((column, index) => {
666
- return /* @__PURE__ */ React7.createElement(TableCell4, {
667
- key: index,
668
- width: index === 0 ? "100%" : void 0,
669
- align: index === 0 ? "left" : "center"
670
- }, /* @__PURE__ */ React7.createElement(Typography5, {
671
- variant: "body2",
672
- noWrap: true
673
- }, payloadColumnNames[column]));
674
- }) : null));
675
- }, "PayloadTableHead");
631
+ const columnsMemo = useMemo4(() => columns ?? payloadTableColumnConfigDefaults(), [columns]);
632
+ return /* @__PURE__ */ jsx7(TableHead2, { ...props, children: /* @__PURE__ */ jsx7(TableRow5, { children: breakPoint ? columnsMemo[breakPoint]?.map((column, index) => {
633
+ return /* @__PURE__ */ jsx7(TableCell4, { width: index === 0 ? "100%" : void 0, align: index === 0 ? "left" : "center", children: /* @__PURE__ */ jsx7(Typography5, { variant: "body2", noWrap: true, children: payloadColumnNames[column] }) }, index);
634
+ }) : null }) });
635
+ };
676
636
 
677
637
  // src/components/Table/TableRowNoData.tsx
678
- import { styled as styled2, TableCell as TableCell5, TableRow as TableRow6, Typography as Typography6 } from "@mui/material";
679
- import React8 from "react";
680
- var TableRowNoData = /* @__PURE__ */ __name(({ additionalCells, hideBorder = false, typographyProps, ...props }) => {
681
- return /* @__PURE__ */ React8.createElement(TableRow6, props, /* @__PURE__ */ React8.createElement(StyledTableCell, {
682
- hideBorder
683
- }, /* @__PURE__ */ React8.createElement(Typography6, {
684
- variant: "body2",
685
- ...typographyProps
686
- }, "No Data To Display...")), additionalCells ? Array.from({
687
- length: additionalCells
688
- }).fill(null).map((_fill, index) => /* @__PURE__ */ React8.createElement(StyledTableCell, {
689
- key: index,
690
- hideBorder
691
- })) : null);
692
- }, "TableRowNoData");
638
+ import {
639
+ styled as styled2,
640
+ TableCell as TableCell5,
641
+ TableRow as TableRow6,
642
+ Typography as Typography6
643
+ } from "@mui/material";
644
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
645
+ var TableRowNoData = ({
646
+ additionalCells,
647
+ hideBorder = false,
648
+ typographyProps,
649
+ ...props
650
+ }) => {
651
+ return /* @__PURE__ */ jsxs5(TableRow6, { ...props, children: [
652
+ /* @__PURE__ */ jsx8(StyledTableCell, { hideBorder, children: /* @__PURE__ */ jsx8(Typography6, { variant: "body2", ...typographyProps, children: "No Data To Display..." }) }),
653
+ additionalCells ? Array.from({ length: additionalCells }).fill(null).map((_fill, index) => /* @__PURE__ */ jsx8(StyledTableCell, { hideBorder }, index)) : null
654
+ ] });
655
+ };
693
656
  var StyledTableCell = styled2(TableCell5, {
694
657
  name: "StyledTableCell",
695
- shouldForwardProp: /* @__PURE__ */ __name((prop) => prop !== "hideBorder", "shouldForwardProp")
696
- })(({ hideBorder }) => ({
697
- ...hideBorder && {
698
- border: "none"
699
- }
700
- }));
658
+ shouldForwardProp: (prop) => prop !== "hideBorder"
659
+ })(({ hideBorder }) => ({ ...hideBorder && { border: "none" } }));
701
660
 
702
661
  // src/components/Table/Table.tsx
703
- var PayloadTableWithRef = /* @__PURE__ */ __name(({ clickableFields, onHashClick, onRowClick, fetchMorePayloads, rowsPerPage: rowsPerPageProp = 25, payloads, columns, PayloadTableHeadComponent = PayloadTableHead, PayloadTableBodyComponent = PayloadTableBody, PayloadTableFooterComponent = PayloadTableFooter, maxSchemaDepth, count = 0, loading = false, variant = "scrollable", ...props }) => {
662
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
663
+ var PayloadTableWithRef = ({
664
+ clickableFields,
665
+ onHashClick,
666
+ onRowClick,
667
+ fetchMorePayloads,
668
+ rowsPerPage: rowsPerPageProp = 25,
669
+ payloads,
670
+ columns,
671
+ PayloadTableHeadComponent = PayloadTableHead,
672
+ PayloadTableBodyComponent = PayloadTableBody,
673
+ PayloadTableFooterComponent = PayloadTableFooter,
674
+ maxSchemaDepth,
675
+ count = 0,
676
+ loading = false,
677
+ variant = "scrollable",
678
+ ...props
679
+ }) => {
704
680
  const [page, setPage] = useState2(0);
705
681
  const [rowsPerPage, setRowsPerPage] = useState2(rowsPerPageProp);
706
682
  const [visiblePayloads, setVisiblePayloads] = useState2([]);
707
683
  const emptyRows = page > 0 ? Math.max(0, (1 + page) * rowsPerPage - count || 0) : 0;
708
684
  useMemo5(() => {
709
685
  setRowsPerPage(rowsPerPageProp);
710
- }, [
711
- rowsPerPageProp
712
- ]);
686
+ }, [rowsPerPageProp]);
713
687
  useMemo5(() => {
714
688
  if (payloads) {
715
689
  setVisiblePayloads(payloads.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage));
716
690
  }
717
- }, [
718
- count,
719
- page,
720
- payloads,
721
- rowsPerPage
722
- ]);
691
+ }, [count, page, payloads, rowsPerPage]);
723
692
  useMemo5(() => {
724
693
  setPage(0);
725
- }, [
726
- payloads
727
- ]);
728
- const handleAdditionalPayloads = /* @__PURE__ */ __name(() => {
694
+ }, [payloads]);
695
+ const handleAdditionalPayloads = () => {
729
696
  if (fetchMorePayloads && payloads) {
730
697
  const buffer = rowsPerPage * 2;
731
698
  const lastVisiblePayload = visiblePayloads?.at(-1);
@@ -736,46 +703,48 @@ var PayloadTableWithRef = /* @__PURE__ */ __name(({ clickableFields, onHashClick
736
703
  }
737
704
  }
738
705
  }
739
- }, "handleAdditionalPayloads");
740
- const handleChangePage = /* @__PURE__ */ __name((_event, newPage) => {
706
+ };
707
+ const handleChangePage = (_event, newPage) => {
741
708
  handleAdditionalPayloads();
742
709
  setPage(newPage);
743
- }, "handleChangePage");
744
- const handleChangeRowsPerPage = /* @__PURE__ */ __name((event) => {
710
+ };
711
+ const handleChangeRowsPerPage = (event) => {
745
712
  setRowsPerPage(Number.parseInt(event.target.value, 10));
746
713
  setPage(0);
747
- }, "handleChangeRowsPerPage");
714
+ };
748
715
  const noResults = useMemo5(() => {
749
716
  return !loading && visiblePayloads.length === 0;
750
- }, [
751
- loading,
752
- visiblePayloads
753
- ]);
754
- return /* @__PURE__ */ React9.createElement(TableEx, {
755
- variant,
756
- ...props
757
- }, /* @__PURE__ */ React9.createElement(PayloadTableHeadComponent, {
758
- columns
759
- }), /* @__PURE__ */ React9.createElement(PayloadTableBodyComponent, {
760
- clickableFields,
761
- payloads: visiblePayloads,
762
- maxSchemaDepth,
763
- onRowClick,
764
- onHashClick,
765
- emptyRows,
766
- noResults,
767
- NoResultRowComponent: TableRowNoData
768
- }), /* @__PURE__ */ React9.createElement(PayloadTableFooterComponent, {
769
- count,
770
- variant,
771
- rowsPerPage,
772
- handleChangePage,
773
- handleChangeRowsPerPage,
774
- fetchMorePayloads,
775
- loading,
776
- page
777
- }));
778
- }, "PayloadTableWithRef");
717
+ }, [loading, visiblePayloads]);
718
+ return /* @__PURE__ */ jsxs6(TableEx, { variant, ...props, children: [
719
+ /* @__PURE__ */ jsx9(PayloadTableHeadComponent, { columns }),
720
+ /* @__PURE__ */ jsx9(
721
+ PayloadTableBodyComponent,
722
+ {
723
+ clickableFields,
724
+ payloads: visiblePayloads,
725
+ maxSchemaDepth,
726
+ onRowClick,
727
+ onHashClick,
728
+ emptyRows,
729
+ noResults,
730
+ NoResultRowComponent: TableRowNoData
731
+ }
732
+ ),
733
+ /* @__PURE__ */ jsx9(
734
+ PayloadTableFooterComponent,
735
+ {
736
+ count,
737
+ variant,
738
+ rowsPerPage,
739
+ handleChangePage,
740
+ handleChangeRowsPerPage,
741
+ fetchMorePayloads,
742
+ loading,
743
+ page
744
+ }
745
+ )
746
+ ] });
747
+ };
779
748
  PayloadTableWithRef.displayName = "PayloadTable";
780
749
  var PayloadTable = PayloadTableWithRef;
781
750
  export {