@meta-1/design 0.0.205 → 0.0.207

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.205",
3
+ "version": "0.0.207",
4
4
  "keywords": [
5
5
  "easykit",
6
6
  "design",
@@ -34,7 +34,7 @@ import {
34
34
  ValueFormatter,
35
35
  } from "@meta-1/design";
36
36
  import { UIXContext } from "@meta-1/design/components/uix/config-provider";
37
- import { LoadingOverlay, NoRowsOverlay } from "./overlays";
37
+ import { NoRowsOverlay } from "./overlays";
38
38
 
39
39
  import "./style.css";
40
40
 
@@ -358,21 +358,21 @@ export function DataGrid<TData>(props: DataGridProps<TData>) {
358
358
  sortable: false,
359
359
  filter: false,
360
360
  headerName: "",
361
- cellClass: cn("!px-0", actionsCellClassName),
361
+ cellClass: cn("px-0", actionsCellClassName),
362
362
  cellRenderer: (params: any) => {
363
363
  let items = rowActions;
364
364
  if (isFunction(rowActions)) {
365
365
  items = rowActions(params.data);
366
366
  }
367
367
  return (
368
- <div className="flex w-full justify-center py-1" onClick={(e) => e.stopPropagation()}>
368
+ <div className="flex w-full justify-center" onClick={(e) => e.stopPropagation()}>
369
369
  <Dropdown
370
370
  align="end"
371
371
  asChild={true}
372
372
  items={items as DropdownMenuItemProps[]}
373
373
  onItemClick={(item) => onRowActionClick?.(item, params.data)}
374
374
  >
375
- <Action className="!p-0 h-6 w-6">
375
+ <Action className="size-6 p-0">
376
376
  <DotsHorizontalIcon />
377
377
  </Action>
378
378
  </Dropdown>
@@ -410,7 +410,6 @@ export function DataGrid<TData>(props: DataGridProps<TData>) {
410
410
  // 注册自定义组件
411
411
  const components = useMemo(
412
412
  () => ({
413
- loadingOverlay: LoadingOverlay,
414
413
  noRowsOverlay: NoRowsOverlay,
415
414
  }),
416
415
  [],
@@ -524,12 +523,6 @@ export function DataGrid<TData>(props: DataGridProps<TData>) {
524
523
  [props],
525
524
  );
526
525
 
527
- // 根据 loading 状态控制覆盖层的显示
528
- useEffect(() => {
529
- if (!gridApiRef.current) return;
530
- gridApiRef.current.setGridOption("loading", loading || false);
531
- }, [loading]);
532
-
533
526
  const gridHeight = useMemo(() => {
534
527
  if (!maxHeight) return undefined;
535
528
  return typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
@@ -580,14 +573,13 @@ export function DataGrid<TData>(props: DataGridProps<TData>) {
580
573
  : undefined
581
574
  }
582
575
  getRowId={getRowId ? (params) => getRowId(params.data) : undefined}
583
- loadingOverlayComponent="loadingOverlay"
584
576
  noRowsOverlayComponent="noRowsOverlay"
585
577
  noRowsOverlayComponentParams={empty ? { noRowsMessage: empty } : undefined}
586
578
  onColumnVisible={onColumnVisible}
587
579
  onGridReady={onGridReady}
588
580
  onRowClicked={handleRowClick}
589
581
  onSelectionChanged={onSelectionChanged}
590
- rowData={loading ? [] : data}
582
+ rowData={data}
591
583
  rowHeight={autoRowHeight ? undefined : typeof rowHeight === "number" ? rowHeight : undefined}
592
584
  rowSelection={checkbox ? "multiple" : undefined}
593
585
  suppressAnimationFrame={false}
@@ -1,6 +1,35 @@
1
1
  @import "../../../assets/style/theme.css";
2
2
 
3
3
  /* 自定义样式已移除,后续按需添加 */
4
- .data-grid {
5
- --ag-row-height: 34px;
4
+ .ag-cell,
5
+ .ag-full-width-row .ag-cell-wrapper.ag-row-group {
6
+ --ag-internal-content-line-height: 24px;
7
+ }
8
+
9
+ /* 隐藏最后一列后面的分割线 */
10
+ :where(.ag-ltr) .ag-header-cell:last-child:after,
11
+ :where(.ag-ltr)
12
+ .ag-header-group-cell:last-child:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after {
13
+ visibility: hidden;
14
+ }
15
+
16
+ /* 设置 cell 的 padding */
17
+ :where(.ag-ltr) .ag-cell:not(.ag-cell-inline-editing),
18
+ :where(.ag-ltr) .ag-full-width-row .ag-cell-wrapper.ag-row-group {
19
+ padding-left: calc(
20
+ var(--ag-cell-horizontal-padding) -
21
+ 1px +
22
+ var(--ag-row-group-indent-size) *
23
+ var(--ag-indentation-level)
24
+ );
25
+ padding-right: calc(var(--ag-cell-horizontal-padding) - 1px);
26
+ padding-top: 4px;
27
+ padding-bottom: 4px;
28
+ font-size: 14px;
29
+ }
30
+
31
+ /* 允许 actions 列溢出 */
32
+ .ag-cell[col-id="actions"] .ag-cell-value:not(.ag-allow-overflow),
33
+ .ag-cell[col-id="actions"] .ag-group-value {
34
+ overflow: visible;
6
35
  }