@meta-1/design 0.0.196 → 0.0.197

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta-1/design",
3
- "version": "0.0.196",
3
+ "version": "0.0.197",
4
4
  "keywords": [
5
5
  "easykit",
6
6
  "design",
@@ -463,54 +463,56 @@ export function DataTable<TData>(props: DataTableProps<TData>) {
463
463
  };
464
464
 
465
465
  return (
466
- <>
467
- {showToolbar ? (
468
- <div
469
- className={cn(
470
- "border-0 border-secondary border-b border-solid pb-2",
471
- "flex items-end",
472
- filter ? "justify-between" : "justify-end",
473
- )}
474
- >
475
- {filter ? <Filters {...filter} load={load} loading={loading} /> : null}
476
- {showVisibilityControl ? (
477
- <Dropdown align="end" asChild={true} items={columnSettings}>
478
- <Action className="!p-0 h-9 w-9">
479
- <LayoutIcon className="h-[18px] w-[18px]" />
480
- </Action>
481
- </Dropdown>
482
- ) : null}
483
- </div>
484
- ) : null}
485
- <div className={cn("relative")}>
486
- {maxHeight ? (
487
- // 有高度限制时:直接渲染 table 元素,避免 Table 组件自带的 overflow-x-auto 包裹层
488
- <div className={cn("overflow-x-auto", !mounted && "invisible")}>
466
+ <div className={cn("relative")}>
467
+ <div className={"flex flex-col gap-md"}>
468
+ <div>
469
+ {showToolbar ? (
489
470
  <div
490
- className="overflow-y-auto"
491
- style={{ maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight }}
471
+ className={cn(
472
+ "border-0 border-secondary border-b border-solid pb-2",
473
+ "flex items-end",
474
+ filter ? "justify-between" : "justify-end",
475
+ )}
492
476
  >
493
- <table
494
- className={classNames(
495
- "data-table data-table-sticky-header w-full caption-bottom text-sm",
496
- inCard ? "in-card" : null,
497
- )}
498
- data-slot="table"
477
+ {filter ? <Filters {...filter} load={load} loading={loading} /> : null}
478
+ {showVisibilityControl ? (
479
+ <Dropdown align="end" asChild={true} items={columnSettings}>
480
+ <Action className="!p-0 h-9 w-9">
481
+ <LayoutIcon className="h-[18px] w-[18px]" />
482
+ </Action>
483
+ </Dropdown>
484
+ ) : null}
485
+ </div>
486
+ ) : null}
487
+ {maxHeight ? (
488
+ // 有高度限制时:直接渲染 table 元素,避免 Table 组件自带的 overflow-x-auto 包裹层
489
+ <div className={cn("overflow-x-auto", !mounted && "invisible")}>
490
+ <div
491
+ className="overflow-y-auto"
492
+ style={{ maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight }}
499
493
  >
500
- {renderTableHeader()}
501
- {renderTableBody()}
502
- </table>
494
+ <table
495
+ className={classNames(
496
+ "data-table data-table-sticky-header w-full caption-bottom text-sm",
497
+ inCard ? "in-card" : null,
498
+ )}
499
+ data-slot="table"
500
+ >
501
+ {renderTableHeader()}
502
+ {renderTableBody()}
503
+ </table>
504
+ </div>
503
505
  </div>
504
- </div>
505
- ) : (
506
- // 无高度限制时,使用原有布局
507
- <Table className={classNames("data-table", inCard ? "in-card" : null, !mounted && "invisible")}>
508
- {renderTableHeader()}
509
- {renderTableBody()}
510
- </Table>
511
- )}
506
+ ) : (
507
+ // 无高度限制时,使用原有布局
508
+ <Table className={classNames("data-table", inCard ? "in-card" : null, !mounted && "invisible")}>
509
+ {renderTableHeader()}
510
+ {renderTableBody()}
511
+ </Table>
512
+ )}
513
+ </div>
512
514
  {showPagination ? (
513
- <div className={cn("py-4", !mounted && "invisible")}>
515
+ <div className={cn(!mounted && "invisible")}>
514
516
  <Pagination
515
517
  {...(pagination as PaginationProps)}
516
518
  onChange={(page: number) => {
@@ -522,12 +524,12 @@ export function DataTable<TData>(props: DataTableProps<TData>) {
522
524
  />
523
525
  </div>
524
526
  ) : null}
525
- {loading || !mounted ? (
526
- <div className="dark:!bg-black/5 absolute top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-white/50">
527
- <Spin />
528
- </div>
529
- ) : null}
530
527
  </div>
531
- </>
528
+ {loading || !mounted ? (
529
+ <div className="dark:!bg-black/5 absolute top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-white/50">
530
+ <Spin />
531
+ </div>
532
+ ) : null}
533
+ </div>
532
534
  );
533
535
  }