@wordrhyme/auto-crud 1.21.2 → 1.22.0

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/README.md CHANGED
@@ -269,6 +269,10 @@ interface AutoCrudTableProps<TSchema> {
269
269
  record: z.output<TSchema>,
270
270
  row: Row<z.output<TSchema>>,
271
271
  ) => React.ReactNode; // 展开行内容,row 提供已解析的单元格上下文
272
+ rowFooter?: (
273
+ record: z.output<TSchema>,
274
+ row: Row<z.output<TSchema>>,
275
+ ) => React.ReactNode; // 跨全部可见列的行尾内容,与展开状态无关
272
276
  filterModes?: FilterMode | FilterMode[]; // 过滤模式
273
277
  batchFields?: (string | BatchUpdateField)[]; // 批量更新字段
274
278
  /** @deprecated 新代码请使用 actions.batch */
@@ -328,6 +332,13 @@ interface AutoCrudTableProps<TSchema> {
328
332
 
329
333
  `expandedRow` 的第二个参数是当前 TanStack `Row`,可通过 `row.getAllCells()` 读取已解析的列和单元格上下文,复用字段渲染器及数据源标签。只接收订单数据的单参数回调仍可使用。
330
334
 
335
+ #### 行尾内容
336
+
337
+ `table.rowFooter(record, row)` 在每行主内容下方、展开详情上方渲染跨全部可见列的内容,收起时仍显示;它不要求配置 `getRowId` 或启用展开。
338
+ 每次渲染对当前行调用一次,返回 `null`、`undefined` 或 `false` 时不创建额外表格行。其他返回值(包括 `0`)按 React 内容渲染。
339
+ 行尾沿用 `classNames.tr` 和 `classNames.td`,消费侧可通过内容类名配合 `classNames.td` 的 `:has()` 选择器单独调整内边距。
340
+ `AutoTable` 和 `DataTable` 通过直接传入 `rowFooter` 使用同一契约;未配置时保留原有 DOM。
341
+
331
342
  #### 表格状态与 URL 参数
332
343
 
333
344
  同页显示多个表格时,在资源 Hook 中配置独立的分页、排序和条件连接符参数名,`AutoCrudTable` 会自动传给表格:
package/dist/index.cjs CHANGED
@@ -1747,6 +1747,7 @@ function ViewMenu({ resourceId, table, fieldsReady = true, defaultView, presets,
1747
1747
  data,
1748
1748
  counts
1749
1749
  });
1750
+ const refreshPending = (0, react.useRef)(false);
1750
1751
  const refetchCounts = totals.refetch;
1751
1752
  (0, react.useEffect)(() => {
1752
1753
  const previous = previousSource.current;
@@ -1754,21 +1755,17 @@ function ViewMenu({ resourceId, table, fieldsReady = true, defaultView, presets,
1754
1755
  data,
1755
1756
  counts
1756
1757
  };
1757
- if (previous.data === data && previous.counts === counts) return;
1758
- if (counts && ready && fieldsReady) client.cancelQueries({ queryKey: [
1759
- "auto-crud-view-counts",
1760
- config.cacheKey,
1761
- resourceId
1762
- ] }).then(() => refetchCounts());
1758
+ if (previous.data !== data || previous.counts !== counts) refreshPending.current = true;
1759
+ if (!counts || !ready || !fieldsReady || totals.fetchStatus !== "idle" || !refreshPending.current) return;
1760
+ refreshPending.current = false;
1761
+ refetchCounts({ cancelRefetch: false });
1763
1762
  }, [
1764
1763
  data,
1765
1764
  counts,
1766
1765
  ready,
1767
1766
  fieldsReady,
1768
- refetchCounts,
1769
- client,
1770
- config.cacheKey,
1771
- resourceId
1767
+ totals.fetchStatus,
1768
+ refetchCounts
1772
1769
  ]);
1773
1770
  const renderCount = (key) => {
1774
1771
  if (!counts) return null;
@@ -3700,7 +3697,7 @@ function formatDate(date, opts = {}, preset) {
3700
3697
 
3701
3698
  //#endregion
3702
3699
  //#region src/components/data-table/data-table.tsx
3703
- function DataTable({ table, actionBar, pagination, expandedRow, children, className, classNames,...props }) {
3700
+ function DataTable({ table, actionBar, pagination, expandedRow, rowFooter, children, className, classNames,...props }) {
3704
3701
  useDateFormatterVersion();
3705
3702
  const columns = [
3706
3703
  ...table.getLeftVisibleLeafColumns(),
@@ -3741,25 +3738,39 @@ function DataTable({ table, actionBar, pagination, expandedRow, children, classN
3741
3738
  }),
3742
3739
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableBody, {
3743
3740
  className: classNames?.tbody,
3744
- children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableRow, {
3745
- className: classNames?.tr,
3746
- "data-state": row.getIsSelected() && "selected",
3747
- children: row.getVisibleCells().map((cell) => {
3748
- const columnClassName = cell.column.columnDef.meta?.classNames?.td;
3749
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableCell, {
3750
- className: cn(hasWidthCap && "overflow-hidden text-ellipsis", classNames?.td, typeof columnClassName === "string" ? columnClassName : void 0),
3751
- style: { ...getColumnPinningStyle({ column: cell.column }) },
3752
- children: (0, __tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
3753
- }, cell.id);
3754
- })
3755
- }), expandedRow && row.getCanExpand() && row.getIsExpanded() && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableRow, {
3756
- className: classNames?.tr,
3757
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableCell, {
3758
- colSpan: row.getVisibleCells().length,
3759
- className: classNames?.td,
3760
- children: expandedRow(row.original, row)
3761
- })
3762
- })] }, row.id)) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableRow, {
3741
+ children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => {
3742
+ const footer = rowFooter?.(row.original, row);
3743
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [
3744
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableRow, {
3745
+ className: classNames?.tr,
3746
+ "data-state": row.getIsSelected() && "selected",
3747
+ children: row.getVisibleCells().map((cell) => {
3748
+ const columnClassName = cell.column.columnDef.meta?.classNames?.td;
3749
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableCell, {
3750
+ className: cn(hasWidthCap && "overflow-hidden text-ellipsis", classNames?.td, typeof columnClassName === "string" ? columnClassName : void 0),
3751
+ style: { ...getColumnPinningStyle({ column: cell.column }) },
3752
+ children: (0, __tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
3753
+ }, cell.id);
3754
+ })
3755
+ }),
3756
+ footer != null && footer !== false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableRow, {
3757
+ className: classNames?.tr,
3758
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableCell, {
3759
+ colSpan: row.getVisibleCells().length,
3760
+ className: classNames?.td,
3761
+ children: footer
3762
+ })
3763
+ }),
3764
+ expandedRow && row.getCanExpand() && row.getIsExpanded() && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableRow, {
3765
+ className: classNames?.tr,
3766
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableCell, {
3767
+ colSpan: row.getVisibleCells().length,
3768
+ className: classNames?.td,
3769
+ children: expandedRow(row.original, row)
3770
+ })
3771
+ })
3772
+ ] }, row.id);
3773
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableRow, {
3763
3774
  className: classNames?.tr,
3764
3775
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.TableCell, {
3765
3776
  colSpan: table.getAllColumns().length,
@@ -7768,7 +7779,7 @@ const filterModeConfig = {
7768
7779
  tooltip: "Linear-style command filters"
7769
7780
  }
7770
7781
  };
7771
- function AutoTable({ resourceId, views, schema, data, getRowId, expandedRow, defaultExpanded = false, pageCount = 1, pagination, total, overrides, classNames, enableRowSelection = true, queryKeys, initialColumnVisibility, exclude, filterOnly, actions, pinnedColumns, filterMode, search = false, batchSearch, filterState, toolbarExtra, locale = enUSTableControls, onDeleteSelected, onUpdateSelected, batchUpdateFields, actionBarExtra, actionBarLocale, actionBarActions, deleteConfirmation, initialSorting, enableExport = true, showDefaultExport = true, onSelectedCountChange, onSelectedRowsChange, getSelectedRows, exportTableRef }) {
7782
+ function AutoTable({ resourceId, views, schema, data, getRowId, expandedRow, rowFooter, defaultExpanded = false, pageCount = 1, pagination, total, overrides, classNames, enableRowSelection = true, queryKeys, initialColumnVisibility, exclude, filterOnly, actions, pinnedColumns, filterMode, search = false, batchSearch, filterState, toolbarExtra, locale = enUSTableControls, onDeleteSelected, onUpdateSelected, batchUpdateFields, actionBarExtra, actionBarLocale, actionBarActions, deleteConfirmation, initialSorting, enableExport = true, showDefaultExport = true, onSelectedCountChange, onSelectedRowsChange, getSelectedRows, exportTableRef }) {
7772
7783
  const inheritedResourceId = (0, react.useContext)(CrudResourceContext);
7773
7784
  const activeResourceId = resourceId ?? inheritedResourceId;
7774
7785
  const viewsEnabled = views ?? false;
@@ -8053,7 +8064,8 @@ function AutoTable({ resourceId, views, schema, data, getRowId, expandedRow, def
8053
8064
  pagination,
8054
8065
  table,
8055
8066
  classNames,
8056
- expandedRow
8067
+ expandedRow,
8068
+ rowFooter
8057
8069
  }), [
8058
8070
  table,
8059
8071
  data,
@@ -8065,6 +8077,7 @@ function AutoTable({ resourceId, views, schema, data, getRowId, expandedRow, def
8065
8077
  pagination,
8066
8078
  classNames,
8067
8079
  expandedRow,
8080
+ rowFooter,
8068
8081
  state.columnFilters,
8069
8082
  state.columnOrder,
8070
8083
  state.columnPinning,
@@ -11103,6 +11116,7 @@ function AutoCrudTable({ id, title, description, schema, resource, fields, table
11103
11116
  initialColumnVisibility: tableConfig?.initialColumnVisibility,
11104
11117
  getRowId: tableConfig?.getRowId,
11105
11118
  expandedRow: tableConfig?.expandedRow,
11119
+ rowFooter: tableConfig?.rowFooter,
11106
11120
  defaultExpanded: tableConfig?.defaultExpanded,
11107
11121
  overrides: tableOverrides,
11108
11122
  classNames: tableConfig?.classNames,
@@ -11854,6 +11868,7 @@ const defaultToastAdapter = {
11854
11868
  info: sonner.toast.info,
11855
11869
  warning: sonner.toast.warning
11856
11870
  };
11871
+ const EMPTY_ROWS = [];
11857
11872
  /** 空 toast 适配器(禁用通知) */
11858
11873
  const noopToastAdapter = {
11859
11874
  success: () => {},
@@ -12047,7 +12062,7 @@ function useAutoCrudResource({ router, queryKeys, schema, query: queryTransform,
12047
12062
  if (listReady && listQuery.data !== void 0) hasReadyListData.current = true;
12048
12063
  }, [listReady, listQuery.data]);
12049
12064
  const listData = listReady ? listQuery.data : void 0;
12050
- const tableRows = listData?.data ?? [];
12065
+ const tableRows = listData?.data ?? EMPTY_ROWS;
12051
12066
  const createMutation = router.create.useMutation();
12052
12067
  const updateMutation = router.update.useMutation();
12053
12068
  const deleteMutation = router.delete.useMutation();
package/dist/index.d.cts CHANGED
@@ -1384,12 +1384,15 @@ interface DataTableProps<TData> extends ComponentProps<'div'> {
1384
1384
  actionBar?: ReactNode;
1385
1385
  /** Content mounted below an expanded row; row provides resolved cell contexts. */
1386
1386
  expandedRow?: (record: TData, row: Row<TData>) => ReactNode;
1387
+ /** Full-width content below a row, before expanded content and independent of expansion. */
1388
+ rowFooter?: (record: TData, row: Row<TData>) => ReactNode;
1387
1389
  }
1388
1390
  declare function DataTable<TData>({
1389
1391
  table,
1390
1392
  actionBar,
1391
1393
  pagination,
1392
1394
  expandedRow,
1395
+ rowFooter,
1393
1396
  children,
1394
1397
  className,
1395
1398
  classNames,
@@ -1622,7 +1625,7 @@ interface TableSearchConfig {
1622
1625
  /** Replaces the entire search control, including prefix and built-in batch controls. */
1623
1626
  render?: (props: TableSearchProps) => React.ReactNode;
1624
1627
  }
1625
- interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> extends Pick<DataTableProps<z.infer<T>>, 'expandedRow'> {
1628
+ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> extends Pick<DataTableProps<z.infer<T>>, 'expandedRow' | 'rowFooter'> {
1626
1629
  /** Stable CRUD identity for saved views and tag services. */
1627
1630
  resourceId?: string;
1628
1631
  /** Disabled by default. Pass true or a config to enable; requires viewStorage and a resourceId. */
@@ -1705,6 +1708,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
1705
1708
  data,
1706
1709
  getRowId,
1707
1710
  expandedRow,
1711
+ rowFooter,
1708
1712
  defaultExpanded,
1709
1713
  pageCount,
1710
1714
  pagination,
@@ -2079,7 +2083,7 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
2079
2083
  batchActions?: BatchActionConfig<z.output<TSchema>>;
2080
2084
  /** 默认排序 */
2081
2085
  defaultSort?: any[];
2082
- } & Pick<AutoTableProps<TSchema>, 'getRowId' | 'expandedRow' | 'defaultExpanded' | 'enableRowSelection' | 'initialColumnVisibility' | 'queryKeys'>;
2086
+ } & Pick<AutoTableProps<TSchema>, 'getRowId' | 'expandedRow' | 'rowFooter' | 'defaultExpanded' | 'enableRowSelection' | 'initialColumnVisibility' | 'queryKeys'>;
2083
2087
  /** 表单配置 */
2084
2088
  form?: {
2085
2089
  /** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
package/dist/index.d.ts CHANGED
@@ -1384,12 +1384,15 @@ interface DataTableProps<TData> extends ComponentProps<'div'> {
1384
1384
  actionBar?: ReactNode;
1385
1385
  /** Content mounted below an expanded row; row provides resolved cell contexts. */
1386
1386
  expandedRow?: (record: TData, row: Row<TData>) => ReactNode;
1387
+ /** Full-width content below a row, before expanded content and independent of expansion. */
1388
+ rowFooter?: (record: TData, row: Row<TData>) => ReactNode;
1387
1389
  }
1388
1390
  declare function DataTable<TData>({
1389
1391
  table,
1390
1392
  actionBar,
1391
1393
  pagination,
1392
1394
  expandedRow,
1395
+ rowFooter,
1393
1396
  children,
1394
1397
  className,
1395
1398
  classNames,
@@ -1622,7 +1625,7 @@ interface TableSearchConfig {
1622
1625
  /** Replaces the entire search control, including prefix and built-in batch controls. */
1623
1626
  render?: (props: TableSearchProps) => React.ReactNode;
1624
1627
  }
1625
- interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> extends Pick<DataTableProps<z.infer<T>>, 'expandedRow'> {
1628
+ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> extends Pick<DataTableProps<z.infer<T>>, 'expandedRow' | 'rowFooter'> {
1626
1629
  /** Stable CRUD identity for saved views and tag services. */
1627
1630
  resourceId?: string;
1628
1631
  /** Disabled by default. Pass true or a config to enable; requires viewStorage and a resourceId. */
@@ -1705,6 +1708,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
1705
1708
  data,
1706
1709
  getRowId,
1707
1710
  expandedRow,
1711
+ rowFooter,
1708
1712
  defaultExpanded,
1709
1713
  pageCount,
1710
1714
  pagination,
@@ -2079,7 +2083,7 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
2079
2083
  batchActions?: BatchActionConfig<z.output<TSchema>>;
2080
2084
  /** 默认排序 */
2081
2085
  defaultSort?: any[];
2082
- } & Pick<AutoTableProps<TSchema>, 'getRowId' | 'expandedRow' | 'defaultExpanded' | 'enableRowSelection' | 'initialColumnVisibility' | 'queryKeys'>;
2086
+ } & Pick<AutoTableProps<TSchema>, 'getRowId' | 'expandedRow' | 'rowFooter' | 'defaultExpanded' | 'enableRowSelection' | 'initialColumnVisibility' | 'queryKeys'>;
2083
2087
  /** 表单配置 */
2084
2088
  form?: {
2085
2089
  /** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
package/dist/index.js CHANGED
@@ -1731,6 +1731,7 @@ function ViewMenu({ resourceId, table, fieldsReady = true, defaultView, presets,
1731
1731
  data,
1732
1732
  counts
1733
1733
  });
1734
+ const refreshPending = useRef(false);
1734
1735
  const refetchCounts = totals.refetch;
1735
1736
  useEffect(() => {
1736
1737
  const previous = previousSource.current;
@@ -1738,21 +1739,17 @@ function ViewMenu({ resourceId, table, fieldsReady = true, defaultView, presets,
1738
1739
  data,
1739
1740
  counts
1740
1741
  };
1741
- if (previous.data === data && previous.counts === counts) return;
1742
- if (counts && ready && fieldsReady) client.cancelQueries({ queryKey: [
1743
- "auto-crud-view-counts",
1744
- config.cacheKey,
1745
- resourceId
1746
- ] }).then(() => refetchCounts());
1742
+ if (previous.data !== data || previous.counts !== counts) refreshPending.current = true;
1743
+ if (!counts || !ready || !fieldsReady || totals.fetchStatus !== "idle" || !refreshPending.current) return;
1744
+ refreshPending.current = false;
1745
+ refetchCounts({ cancelRefetch: false });
1747
1746
  }, [
1748
1747
  data,
1749
1748
  counts,
1750
1749
  ready,
1751
1750
  fieldsReady,
1752
- refetchCounts,
1753
- client,
1754
- config.cacheKey,
1755
- resourceId
1751
+ totals.fetchStatus,
1752
+ refetchCounts
1756
1753
  ]);
1757
1754
  const renderCount = (key) => {
1758
1755
  if (!counts) return null;
@@ -3684,7 +3681,7 @@ function formatDate(date, opts = {}, preset) {
3684
3681
 
3685
3682
  //#endregion
3686
3683
  //#region src/components/data-table/data-table.tsx
3687
- function DataTable({ table, actionBar, pagination, expandedRow, children, className, classNames,...props }) {
3684
+ function DataTable({ table, actionBar, pagination, expandedRow, rowFooter, children, className, classNames,...props }) {
3688
3685
  useDateFormatterVersion();
3689
3686
  const columns = [
3690
3687
  ...table.getLeftVisibleLeafColumns(),
@@ -3725,25 +3722,39 @@ function DataTable({ table, actionBar, pagination, expandedRow, children, classN
3725
3722
  }),
3726
3723
  /* @__PURE__ */ jsx(TableBody, {
3727
3724
  className: classNames?.tbody,
3728
- children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TableRow, {
3729
- className: classNames?.tr,
3730
- "data-state": row.getIsSelected() && "selected",
3731
- children: row.getVisibleCells().map((cell) => {
3732
- const columnClassName = cell.column.columnDef.meta?.classNames?.td;
3733
- return /* @__PURE__ */ jsx(TableCell, {
3734
- className: cn(hasWidthCap && "overflow-hidden text-ellipsis", classNames?.td, typeof columnClassName === "string" ? columnClassName : void 0),
3735
- style: { ...getColumnPinningStyle({ column: cell.column }) },
3736
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
3737
- }, cell.id);
3738
- })
3739
- }), expandedRow && row.getCanExpand() && row.getIsExpanded() && /* @__PURE__ */ jsx(TableRow, {
3740
- className: classNames?.tr,
3741
- children: /* @__PURE__ */ jsx(TableCell, {
3742
- colSpan: row.getVisibleCells().length,
3743
- className: classNames?.td,
3744
- children: expandedRow(row.original, row)
3745
- })
3746
- })] }, row.id)) : /* @__PURE__ */ jsx(TableRow, {
3725
+ children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => {
3726
+ const footer = rowFooter?.(row.original, row);
3727
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3728
+ /* @__PURE__ */ jsx(TableRow, {
3729
+ className: classNames?.tr,
3730
+ "data-state": row.getIsSelected() && "selected",
3731
+ children: row.getVisibleCells().map((cell) => {
3732
+ const columnClassName = cell.column.columnDef.meta?.classNames?.td;
3733
+ return /* @__PURE__ */ jsx(TableCell, {
3734
+ className: cn(hasWidthCap && "overflow-hidden text-ellipsis", classNames?.td, typeof columnClassName === "string" ? columnClassName : void 0),
3735
+ style: { ...getColumnPinningStyle({ column: cell.column }) },
3736
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
3737
+ }, cell.id);
3738
+ })
3739
+ }),
3740
+ footer != null && footer !== false && /* @__PURE__ */ jsx(TableRow, {
3741
+ className: classNames?.tr,
3742
+ children: /* @__PURE__ */ jsx(TableCell, {
3743
+ colSpan: row.getVisibleCells().length,
3744
+ className: classNames?.td,
3745
+ children: footer
3746
+ })
3747
+ }),
3748
+ expandedRow && row.getCanExpand() && row.getIsExpanded() && /* @__PURE__ */ jsx(TableRow, {
3749
+ className: classNames?.tr,
3750
+ children: /* @__PURE__ */ jsx(TableCell, {
3751
+ colSpan: row.getVisibleCells().length,
3752
+ className: classNames?.td,
3753
+ children: expandedRow(row.original, row)
3754
+ })
3755
+ })
3756
+ ] }, row.id);
3757
+ }) : /* @__PURE__ */ jsx(TableRow, {
3747
3758
  className: classNames?.tr,
3748
3759
  children: /* @__PURE__ */ jsx(TableCell, {
3749
3760
  colSpan: table.getAllColumns().length,
@@ -7752,7 +7763,7 @@ const filterModeConfig = {
7752
7763
  tooltip: "Linear-style command filters"
7753
7764
  }
7754
7765
  };
7755
- function AutoTable({ resourceId, views, schema, data, getRowId, expandedRow, defaultExpanded = false, pageCount = 1, pagination, total, overrides, classNames, enableRowSelection = true, queryKeys, initialColumnVisibility, exclude, filterOnly, actions, pinnedColumns, filterMode, search = false, batchSearch, filterState, toolbarExtra, locale = enUSTableControls, onDeleteSelected, onUpdateSelected, batchUpdateFields, actionBarExtra, actionBarLocale, actionBarActions, deleteConfirmation, initialSorting, enableExport = true, showDefaultExport = true, onSelectedCountChange, onSelectedRowsChange, getSelectedRows, exportTableRef }) {
7766
+ function AutoTable({ resourceId, views, schema, data, getRowId, expandedRow, rowFooter, defaultExpanded = false, pageCount = 1, pagination, total, overrides, classNames, enableRowSelection = true, queryKeys, initialColumnVisibility, exclude, filterOnly, actions, pinnedColumns, filterMode, search = false, batchSearch, filterState, toolbarExtra, locale = enUSTableControls, onDeleteSelected, onUpdateSelected, batchUpdateFields, actionBarExtra, actionBarLocale, actionBarActions, deleteConfirmation, initialSorting, enableExport = true, showDefaultExport = true, onSelectedCountChange, onSelectedRowsChange, getSelectedRows, exportTableRef }) {
7756
7767
  const inheritedResourceId = useContext(CrudResourceContext);
7757
7768
  const activeResourceId = resourceId ?? inheritedResourceId;
7758
7769
  const viewsEnabled = views ?? false;
@@ -8037,7 +8048,8 @@ function AutoTable({ resourceId, views, schema, data, getRowId, expandedRow, def
8037
8048
  pagination,
8038
8049
  table,
8039
8050
  classNames,
8040
- expandedRow
8051
+ expandedRow,
8052
+ rowFooter
8041
8053
  }), [
8042
8054
  table,
8043
8055
  data,
@@ -8049,6 +8061,7 @@ function AutoTable({ resourceId, views, schema, data, getRowId, expandedRow, def
8049
8061
  pagination,
8050
8062
  classNames,
8051
8063
  expandedRow,
8064
+ rowFooter,
8052
8065
  state.columnFilters,
8053
8066
  state.columnOrder,
8054
8067
  state.columnPinning,
@@ -11087,6 +11100,7 @@ function AutoCrudTable({ id, title, description, schema, resource, fields, table
11087
11100
  initialColumnVisibility: tableConfig?.initialColumnVisibility,
11088
11101
  getRowId: tableConfig?.getRowId,
11089
11102
  expandedRow: tableConfig?.expandedRow,
11103
+ rowFooter: tableConfig?.rowFooter,
11090
11104
  defaultExpanded: tableConfig?.defaultExpanded,
11091
11105
  overrides: tableOverrides,
11092
11106
  classNames: tableConfig?.classNames,
@@ -11838,6 +11852,7 @@ const defaultToastAdapter = {
11838
11852
  info: toast.info,
11839
11853
  warning: toast.warning
11840
11854
  };
11855
+ const EMPTY_ROWS = [];
11841
11856
  /** 空 toast 适配器(禁用通知) */
11842
11857
  const noopToastAdapter = {
11843
11858
  success: () => {},
@@ -12031,7 +12046,7 @@ function useAutoCrudResource({ router, queryKeys, schema, query: queryTransform,
12031
12046
  if (listReady && listQuery.data !== void 0) hasReadyListData.current = true;
12032
12047
  }, [listReady, listQuery.data]);
12033
12048
  const listData = listReady ? listQuery.data : void 0;
12034
- const tableRows = listData?.data ?? [];
12049
+ const tableRows = listData?.data ?? EMPTY_ROWS;
12035
12050
  const createMutation = router.create.useMutation();
12036
12051
  const updateMutation = router.update.useMutation();
12037
12052
  const deleteMutation = router.delete.useMutation();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wordrhyme/auto-crud",
3
3
  "type": "module",
4
- "version": "1.21.2",
4
+ "version": "1.22.0",
5
5
  "description": "Schema-first CRUD components with auto-generated tables and forms",
6
6
  "author": "wordrhyme",
7
7
  "license": "MIT",
@@ -71,9 +71,9 @@
71
71
  "nanoid": "^5.1.6",
72
72
  "tailwind-merge": "^3.5.0",
73
73
  "vaul": "^1.1.2",
74
+ "@wordrhyme/formily-shadcn": "2.1.3",
74
75
  "@wordrhyme/shadcn": "2.0.2",
75
- "@wordrhyme/shadcn-ui": "2.1.3",
76
- "@wordrhyme/formily-shadcn": "2.1.3"
76
+ "@wordrhyme/shadcn-ui": "2.1.3"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@storybook/react": "^8.6.18",
@@ -94,11 +94,11 @@
94
94
  "tsdown": "^0.15.12",
95
95
  "typescript": "^5.9.3",
96
96
  "vitest": "^3.2.4",
97
+ "@internal/eslint-config": "0.3.0",
97
98
  "@internal/prettier-config": "0.0.1",
98
99
  "@internal/tsconfig": "0.1.0",
99
100
  "@internal/tsdown-config": "0.1.0",
100
- "@internal/vitest-config": "0.1.0",
101
- "@internal/eslint-config": "0.3.0"
101
+ "@internal/vitest-config": "0.1.0"
102
102
  },
103
103
  "prettier": "@internal/prettier-config",
104
104
  "scripts": {