@wordrhyme/auto-crud 1.23.2 → 1.24.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 +6 -0
- package/dist/index.cjs +357 -185
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +358 -186
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,9 +2,9 @@ import { a as positionActions, i as matchesPosition, n as actionPositionSchema,
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
import { ComponentProps, ReactNode } from "react";
|
|
5
|
-
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
6
5
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
7
6
|
import { Column, ColumnDef, ColumnMeta, ColumnSort, Row, RowData, Table, TableOptions, TableState, VisibilityState } from "@tanstack/react-table";
|
|
7
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
8
8
|
import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
|
|
9
9
|
import { ISchema } from "@formily/json-schema";
|
|
10
10
|
import { DropdownMenuItem } from "@wordrhyme/ui";
|
|
@@ -111,6 +111,12 @@ interface BatchSearchLocale {
|
|
|
111
111
|
combination: string;
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
|
+
//#region src/lib/data-table.d.ts
|
|
115
|
+
/** Stable for one result set. Each mounted table observes its successful deletions. */
|
|
116
|
+
interface RowSelectionScope<TData> {
|
|
117
|
+
onDelete: (listener: (deleted: TData) => void) => () => void;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
114
120
|
//#region src/lib/default-sorting.d.ts
|
|
115
121
|
type AutoCrudSorting = Array<{
|
|
116
122
|
id: string;
|
|
@@ -742,6 +748,10 @@ interface UseAutoCrudResourceReturn<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
742
748
|
idKey?: keyof TListItem & string;
|
|
743
749
|
tableData: {
|
|
744
750
|
data: TListItem[];
|
|
751
|
+
/** @internal Scope of the effective list query and its confirmed deletions. */
|
|
752
|
+
selectionScope?: RowSelectionScope<TListItem>;
|
|
753
|
+
/** True while showing rows from the previous request. */
|
|
754
|
+
isPlaceholderData?: boolean;
|
|
745
755
|
/** @internal Used by AutoCrudTable to refresh saved-view counts. */
|
|
746
756
|
countSource?: ViewCountSource;
|
|
747
757
|
pageCount: number;
|
|
@@ -929,6 +939,8 @@ interface TableControlsLocale {
|
|
|
929
939
|
}
|
|
930
940
|
interface TablePaginationLocale {
|
|
931
941
|
selected: (count: number, total: number) => string;
|
|
942
|
+
/** Selection summary when the server omits the total across pages. */
|
|
943
|
+
selectedCount?: (count: number) => string;
|
|
932
944
|
total: (count: number) => string;
|
|
933
945
|
rowsPerPage: string;
|
|
934
946
|
page: (page: number, total: number) => string;
|
|
@@ -1188,6 +1200,8 @@ interface TablePaginationOptions {
|
|
|
1188
1200
|
}
|
|
1189
1201
|
declare module '@tanstack/react-table' {
|
|
1190
1202
|
interface TableMeta<TData extends RowData> {
|
|
1203
|
+
/** Selected records retained by AutoTable across server pages. */
|
|
1204
|
+
selectedRows?: Row<TData>[];
|
|
1191
1205
|
queryKeys?: QueryKeys;
|
|
1192
1206
|
queryStateOptions?: UrlStateOptions;
|
|
1193
1207
|
filterState?: TableFilterState<TData>;
|
|
@@ -1643,6 +1657,12 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> extends Pick<Data
|
|
|
1643
1657
|
data: z.infer<T>[];
|
|
1644
1658
|
/** Stable row identity; required when expandedRow is provided. */
|
|
1645
1659
|
getRowId?: TableOptions<z.infer<T>>['getRowId'];
|
|
1660
|
+
/** Business key for row selection. Defaults to id; getRowId takes precedence. */
|
|
1661
|
+
idKey?: string;
|
|
1662
|
+
/** @internal Result set supplied by useAutoCrudResource. */
|
|
1663
|
+
selectionScope?: RowSelectionScope<z.infer<T>>;
|
|
1664
|
+
/** Displayed rows are loading or belong to a previous request. */
|
|
1665
|
+
pagePending?: boolean;
|
|
1646
1666
|
/** Initially expand all rows. Defaults to false; only applies with expandedRow. */
|
|
1647
1667
|
defaultExpanded?: boolean;
|
|
1648
1668
|
pageCount?: number;
|
|
@@ -1716,6 +1736,9 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1716
1736
|
schema,
|
|
1717
1737
|
data,
|
|
1718
1738
|
getRowId,
|
|
1739
|
+
idKey,
|
|
1740
|
+
selectionScope,
|
|
1741
|
+
pagePending,
|
|
1719
1742
|
expandedRow,
|
|
1720
1743
|
rowFooter,
|
|
1721
1744
|
defaultExpanded,
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
|
5
5
|
import { DropdownMenuTrigger, PopoverContentProps } from "@wordrhyme/shadcn";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { ClassValue } from "clsx";
|
|
8
|
-
import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps, Select, SelectMode, SelectOption, SelectProps, SelectSearchableDynamicProps, SelectSearchableMultipleProps, SelectSearchableProps, SelectSearchableSingleProps, SelectSimpleProps, SelectTriggerRenderProps } from "@wordrhyme/shadcn-ui";
|
|
9
8
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
10
9
|
import { Column, ColumnDef, ColumnMeta, ColumnSort, Row, RowData, Table as Table$1, TableOptions, TableState, VisibilityState } from "@tanstack/react-table";
|
|
10
|
+
import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps, Select, SelectMode, SelectOption, SelectProps, SelectSearchableDynamicProps, SelectSearchableMultipleProps, SelectSearchableProps, SelectSearchableSingleProps, SelectSimpleProps, SelectTriggerRenderProps } from "@wordrhyme/shadcn-ui";
|
|
11
11
|
import { DropdownMenuItem as DropdownMenuItem$1 } from "@wordrhyme/ui";
|
|
12
12
|
import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
|
|
13
13
|
import { ISchema } from "@formily/json-schema";
|
|
@@ -111,6 +111,12 @@ interface BatchSearchLocale {
|
|
|
111
111
|
combination: string;
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
|
+
//#region src/lib/data-table.d.ts
|
|
115
|
+
/** Stable for one result set. Each mounted table observes its successful deletions. */
|
|
116
|
+
interface RowSelectionScope<TData> {
|
|
117
|
+
onDelete: (listener: (deleted: TData) => void) => () => void;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
114
120
|
//#region src/lib/default-sorting.d.ts
|
|
115
121
|
type AutoCrudSorting = Array<{
|
|
116
122
|
id: string;
|
|
@@ -742,6 +748,10 @@ interface UseAutoCrudResourceReturn<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
742
748
|
idKey?: keyof TListItem & string;
|
|
743
749
|
tableData: {
|
|
744
750
|
data: TListItem[];
|
|
751
|
+
/** @internal Scope of the effective list query and its confirmed deletions. */
|
|
752
|
+
selectionScope?: RowSelectionScope<TListItem>;
|
|
753
|
+
/** True while showing rows from the previous request. */
|
|
754
|
+
isPlaceholderData?: boolean;
|
|
745
755
|
/** @internal Used by AutoCrudTable to refresh saved-view counts. */
|
|
746
756
|
countSource?: ViewCountSource;
|
|
747
757
|
pageCount: number;
|
|
@@ -929,6 +939,8 @@ interface TableControlsLocale {
|
|
|
929
939
|
}
|
|
930
940
|
interface TablePaginationLocale {
|
|
931
941
|
selected: (count: number, total: number) => string;
|
|
942
|
+
/** Selection summary when the server omits the total across pages. */
|
|
943
|
+
selectedCount?: (count: number) => string;
|
|
932
944
|
total: (count: number) => string;
|
|
933
945
|
rowsPerPage: string;
|
|
934
946
|
page: (page: number, total: number) => string;
|
|
@@ -1188,6 +1200,8 @@ interface TablePaginationOptions {
|
|
|
1188
1200
|
}
|
|
1189
1201
|
declare module '@tanstack/react-table' {
|
|
1190
1202
|
interface TableMeta<TData extends RowData> {
|
|
1203
|
+
/** Selected records retained by AutoTable across server pages. */
|
|
1204
|
+
selectedRows?: Row<TData>[];
|
|
1191
1205
|
queryKeys?: QueryKeys;
|
|
1192
1206
|
queryStateOptions?: UrlStateOptions;
|
|
1193
1207
|
filterState?: TableFilterState<TData>;
|
|
@@ -1643,6 +1657,12 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> extends Pick<Data
|
|
|
1643
1657
|
data: z.infer<T>[];
|
|
1644
1658
|
/** Stable row identity; required when expandedRow is provided. */
|
|
1645
1659
|
getRowId?: TableOptions<z.infer<T>>['getRowId'];
|
|
1660
|
+
/** Business key for row selection. Defaults to id; getRowId takes precedence. */
|
|
1661
|
+
idKey?: string;
|
|
1662
|
+
/** @internal Result set supplied by useAutoCrudResource. */
|
|
1663
|
+
selectionScope?: RowSelectionScope<z.infer<T>>;
|
|
1664
|
+
/** Displayed rows are loading or belong to a previous request. */
|
|
1665
|
+
pagePending?: boolean;
|
|
1646
1666
|
/** Initially expand all rows. Defaults to false; only applies with expandedRow. */
|
|
1647
1667
|
defaultExpanded?: boolean;
|
|
1648
1668
|
pageCount?: number;
|
|
@@ -1716,6 +1736,9 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1716
1736
|
schema,
|
|
1717
1737
|
data,
|
|
1718
1738
|
getRowId,
|
|
1739
|
+
idKey,
|
|
1740
|
+
selectionScope,
|
|
1741
|
+
pagePending,
|
|
1719
1742
|
expandedRow,
|
|
1720
1743
|
rowFooter,
|
|
1721
1744
|
defaultExpanded,
|