@wordrhyme/auto-crud 0.4.0 → 0.4.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.
- package/dist/index.cjs +53 -4
- package/dist/index.d.cts +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.js +50 -1
- package/package.json +38 -36
- package/LICENSE +0 -21
package/dist/index.cjs
CHANGED
|
@@ -169,6 +169,55 @@ function DataTablePagination({ table, pageSizeOptions = [
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/components/ui/table.tsx
|
|
174
|
+
function Table({ className,...props }) {
|
|
175
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
176
|
+
"data-slot": "table-container",
|
|
177
|
+
className: "relative w-full overflow-x-auto",
|
|
178
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
|
|
179
|
+
"data-slot": "table",
|
|
180
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
181
|
+
...props
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function TableHeader({ className,...props }) {
|
|
186
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", {
|
|
187
|
+
"data-slot": "table-header",
|
|
188
|
+
className: cn("[&_tr]:border-b", className),
|
|
189
|
+
...props
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function TableBody({ className,...props }) {
|
|
193
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
|
|
194
|
+
"data-slot": "table-body",
|
|
195
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
196
|
+
...props
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function TableRow({ className,...props }) {
|
|
200
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
|
|
201
|
+
"data-slot": "table-row",
|
|
202
|
+
className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
203
|
+
...props
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function TableHead({ className,...props }) {
|
|
207
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
208
|
+
"data-slot": "table-head",
|
|
209
|
+
className: cn("h-10 whitespace-nowrap px-2 text-left align-middle font-medium text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
210
|
+
...props
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function TableCell({ className,...props }) {
|
|
214
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
215
|
+
"data-slot": "table-cell",
|
|
216
|
+
className: cn("whitespace-nowrap p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
217
|
+
...props
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
172
221
|
//#endregion
|
|
173
222
|
//#region src/config/data-table.ts
|
|
174
223
|
const dataTableConfig = {
|
|
@@ -401,17 +450,17 @@ function DataTable({ table, actionBar, children, className,...props }) {
|
|
|
401
450
|
children,
|
|
402
451
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
403
452
|
className: "overflow-hidden rounded-md border",
|
|
404
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
453
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Table, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableHead, {
|
|
405
454
|
colSpan: header.colSpan,
|
|
406
455
|
style: { ...getColumnPinningStyle({ column: header.column }) },
|
|
407
456
|
children: header.isPlaceholder ? null : (0, __tanstack_react_table.flexRender)(header.column.columnDef.header, header.getContext())
|
|
408
|
-
}, header.id)) }, headerGroup.id)) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
457
|
+
}, header.id)) }, headerGroup.id)) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, {
|
|
409
458
|
"data-state": row.getIsSelected() && "selected",
|
|
410
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
459
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCell, {
|
|
411
460
|
style: { ...getColumnPinningStyle({ column: cell.column }) },
|
|
412
461
|
children: (0, __tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
|
|
413
462
|
}, cell.id))
|
|
414
|
-
}, row.id)) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
463
|
+
}, row.id)) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCell, {
|
|
415
464
|
colSpan: table.getAllColumns().length,
|
|
416
465
|
className: "h-24 text-center",
|
|
417
466
|
children: "No results."
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
4
4
|
import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
|
|
@@ -243,7 +243,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
243
243
|
enableExport,
|
|
244
244
|
enableDelete,
|
|
245
245
|
extraActions
|
|
246
|
-
}: AutoTableActionBarProps<TData>):
|
|
246
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/lib/schema-bridge/types.d.ts
|
|
249
249
|
/**
|
|
@@ -386,7 +386,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
386
386
|
actionBarExtra,
|
|
387
387
|
initialSorting,
|
|
388
388
|
enableExport
|
|
389
|
-
}: AutoTableProps<T>):
|
|
389
|
+
}: AutoTableProps<T>): react_jsx_runtime3.JSX.Element;
|
|
390
390
|
//#endregion
|
|
391
391
|
//#region src/components/auto-crud/auto-crud-table.d.ts
|
|
392
392
|
/**
|
|
@@ -513,7 +513,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
513
513
|
form: formConfig,
|
|
514
514
|
slots,
|
|
515
515
|
permissions
|
|
516
|
-
}: AutoCrudTableProps<TSchema>):
|
|
516
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime3.JSX.Element;
|
|
517
517
|
//#endregion
|
|
518
518
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
519
519
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -545,7 +545,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
545
545
|
labelAlign,
|
|
546
546
|
labelWidth,
|
|
547
547
|
showSubmitButton
|
|
548
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
548
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime3.JSX.Element;
|
|
549
549
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
550
550
|
ref?: React.Ref<AutoFormRef>;
|
|
551
551
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -759,12 +759,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
759
759
|
variant: z.ZodEnum<{
|
|
760
760
|
number: "number";
|
|
761
761
|
boolean: "boolean";
|
|
762
|
-
date: "date";
|
|
763
762
|
text: "text";
|
|
763
|
+
range: "range";
|
|
764
|
+
date: "date";
|
|
765
|
+
dateRange: "dateRange";
|
|
764
766
|
select: "select";
|
|
765
767
|
multiSelect: "multiSelect";
|
|
766
|
-
dateRange: "dateRange";
|
|
767
|
-
range: "range";
|
|
768
768
|
}>;
|
|
769
769
|
operator: z.ZodEnum<{
|
|
770
770
|
iLike: "iLike";
|
|
@@ -840,7 +840,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
840
840
|
shallow,
|
|
841
841
|
filters: externalFilters,
|
|
842
842
|
onFiltersChange
|
|
843
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
843
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime3.JSX.Element | null;
|
|
844
844
|
//#endregion
|
|
845
845
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
846
846
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -875,7 +875,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
875
875
|
title,
|
|
876
876
|
labelAlign,
|
|
877
877
|
labelWidth
|
|
878
|
-
}: CrudFormModalProps<T>):
|
|
878
|
+
}: CrudFormModalProps<T>): react_jsx_runtime3.JSX.Element;
|
|
879
879
|
//#endregion
|
|
880
880
|
//#region src/components/data-table/data-table.d.ts
|
|
881
881
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -888,7 +888,7 @@ declare function DataTable<TData>({
|
|
|
888
888
|
children,
|
|
889
889
|
className,
|
|
890
890
|
...props
|
|
891
|
-
}: DataTableProps<TData>):
|
|
891
|
+
}: DataTableProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
892
892
|
//#endregion
|
|
893
893
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
894
894
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -899,7 +899,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
899
899
|
children,
|
|
900
900
|
className,
|
|
901
901
|
...props
|
|
902
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
902
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
903
903
|
//#endregion
|
|
904
904
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
905
905
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -911,7 +911,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
911
911
|
label,
|
|
912
912
|
className,
|
|
913
913
|
...props
|
|
914
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
914
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
915
915
|
//#endregion
|
|
916
916
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
917
917
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -925,7 +925,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
925
925
|
title,
|
|
926
926
|
options,
|
|
927
927
|
multiple
|
|
928
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
928
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
929
929
|
//#endregion
|
|
930
930
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
931
931
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -937,7 +937,7 @@ declare function DataTablePagination<TData>({
|
|
|
937
937
|
pageSizeOptions,
|
|
938
938
|
className,
|
|
939
939
|
...props
|
|
940
|
-
}: DataTablePaginationProps<TData>):
|
|
940
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
941
941
|
//#endregion
|
|
942
942
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
943
943
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -948,7 +948,7 @@ declare function DataTableToolbar<TData>({
|
|
|
948
948
|
children,
|
|
949
949
|
className,
|
|
950
950
|
...props
|
|
951
|
-
}: DataTableToolbarProps<TData>):
|
|
951
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
952
952
|
//#endregion
|
|
953
953
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
954
954
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -959,7 +959,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
959
959
|
table,
|
|
960
960
|
disabled,
|
|
961
961
|
...props
|
|
962
|
-
}: DataTableViewOptionsProps<TData>):
|
|
962
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
963
963
|
//#endregion
|
|
964
964
|
//#region src/hooks/use-data-table.d.ts
|
|
965
965
|
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
|
3
3
|
import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
|
|
4
4
|
import { DropdownMenuTrigger, PopoverContent } from "@pixpilot/shadcn";
|
|
5
5
|
import { ClassValue } from "clsx";
|
|
6
|
-
import * as
|
|
6
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { ISchema } from "@formily/json-schema";
|
|
9
9
|
|
|
@@ -243,7 +243,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
243
243
|
enableExport,
|
|
244
244
|
enableDelete,
|
|
245
245
|
extraActions
|
|
246
|
-
}: AutoTableActionBarProps<TData>):
|
|
246
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime11.JSX.Element;
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/lib/schema-bridge/types.d.ts
|
|
249
249
|
/**
|
|
@@ -386,7 +386,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
386
386
|
actionBarExtra,
|
|
387
387
|
initialSorting,
|
|
388
388
|
enableExport
|
|
389
|
-
}: AutoTableProps<T>):
|
|
389
|
+
}: AutoTableProps<T>): react_jsx_runtime11.JSX.Element;
|
|
390
390
|
//#endregion
|
|
391
391
|
//#region src/components/auto-crud/auto-crud-table.d.ts
|
|
392
392
|
/**
|
|
@@ -513,7 +513,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
513
513
|
form: formConfig,
|
|
514
514
|
slots,
|
|
515
515
|
permissions
|
|
516
|
-
}: AutoCrudTableProps<TSchema>):
|
|
516
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime11.JSX.Element;
|
|
517
517
|
//#endregion
|
|
518
518
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
519
519
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -545,7 +545,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
545
545
|
labelAlign,
|
|
546
546
|
labelWidth,
|
|
547
547
|
showSubmitButton
|
|
548
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
548
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime11.JSX.Element;
|
|
549
549
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
550
550
|
ref?: React.Ref<AutoFormRef>;
|
|
551
551
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -759,12 +759,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
759
759
|
variant: z.ZodEnum<{
|
|
760
760
|
number: "number";
|
|
761
761
|
boolean: "boolean";
|
|
762
|
-
date: "date";
|
|
763
762
|
text: "text";
|
|
763
|
+
range: "range";
|
|
764
|
+
date: "date";
|
|
765
|
+
dateRange: "dateRange";
|
|
764
766
|
select: "select";
|
|
765
767
|
multiSelect: "multiSelect";
|
|
766
|
-
dateRange: "dateRange";
|
|
767
|
-
range: "range";
|
|
768
768
|
}>;
|
|
769
769
|
operator: z.ZodEnum<{
|
|
770
770
|
iLike: "iLike";
|
|
@@ -840,7 +840,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
840
840
|
shallow,
|
|
841
841
|
filters: externalFilters,
|
|
842
842
|
onFiltersChange
|
|
843
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
843
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime11.JSX.Element | null;
|
|
844
844
|
//#endregion
|
|
845
845
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
846
846
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -875,7 +875,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
875
875
|
title,
|
|
876
876
|
labelAlign,
|
|
877
877
|
labelWidth
|
|
878
|
-
}: CrudFormModalProps<T>):
|
|
878
|
+
}: CrudFormModalProps<T>): react_jsx_runtime11.JSX.Element;
|
|
879
879
|
//#endregion
|
|
880
880
|
//#region src/components/data-table/data-table.d.ts
|
|
881
881
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -888,7 +888,7 @@ declare function DataTable<TData>({
|
|
|
888
888
|
children,
|
|
889
889
|
className,
|
|
890
890
|
...props
|
|
891
|
-
}: DataTableProps<TData>):
|
|
891
|
+
}: DataTableProps<TData>): react_jsx_runtime11.JSX.Element;
|
|
892
892
|
//#endregion
|
|
893
893
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
894
894
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -899,7 +899,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
899
899
|
children,
|
|
900
900
|
className,
|
|
901
901
|
...props
|
|
902
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
902
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime11.JSX.Element;
|
|
903
903
|
//#endregion
|
|
904
904
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
905
905
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -911,7 +911,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
911
911
|
label,
|
|
912
912
|
className,
|
|
913
913
|
...props
|
|
914
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
914
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime11.JSX.Element;
|
|
915
915
|
//#endregion
|
|
916
916
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
917
917
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -925,7 +925,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
925
925
|
title,
|
|
926
926
|
options,
|
|
927
927
|
multiple
|
|
928
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
928
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime11.JSX.Element;
|
|
929
929
|
//#endregion
|
|
930
930
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
931
931
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -937,7 +937,7 @@ declare function DataTablePagination<TData>({
|
|
|
937
937
|
pageSizeOptions,
|
|
938
938
|
className,
|
|
939
939
|
...props
|
|
940
|
-
}: DataTablePaginationProps<TData>):
|
|
940
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime11.JSX.Element;
|
|
941
941
|
//#endregion
|
|
942
942
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
943
943
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -948,7 +948,7 @@ declare function DataTableToolbar<TData>({
|
|
|
948
948
|
children,
|
|
949
949
|
className,
|
|
950
950
|
...props
|
|
951
|
-
}: DataTableToolbarProps<TData>):
|
|
951
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime11.JSX.Element;
|
|
952
952
|
//#endregion
|
|
953
953
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
954
954
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -959,7 +959,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
959
959
|
table,
|
|
960
960
|
disabled,
|
|
961
961
|
...props
|
|
962
|
-
}: DataTableViewOptionsProps<TData>):
|
|
962
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime11.JSX.Element;
|
|
963
963
|
//#endregion
|
|
964
964
|
//#region src/hooks/use-data-table.d.ts
|
|
965
965
|
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useReducer, useRef, useState } from "react";
|
|
3
3
|
import { ArrowDownUp, BadgeCheck, CalendarIcon, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsUpDown, CommandIcon, Download, Ellipsis, EyeOff, FileSpreadsheetIcon, GripVertical, ListFilter, ListFilterIcon, PlusCircle, Settings2, Text, Trash2, X, XCircle } from "lucide-react";
|
|
4
4
|
import { flexRender, getCoreRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
5
|
-
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Badge, Button, Calendar, Checkbox, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, Input, Label, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, Slider, Switch
|
|
5
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Badge, Button, Calendar, Checkbox, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, Input, Label, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, Slider, Switch } from "@pixpilot/shadcn";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
import { twMerge } from "tailwind-merge";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -127,6 +127,55 @@ function DataTablePagination({ table, pageSizeOptions = [
|
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/components/ui/table.tsx
|
|
132
|
+
function Table$1({ className,...props }) {
|
|
133
|
+
return /* @__PURE__ */ jsx("div", {
|
|
134
|
+
"data-slot": "table-container",
|
|
135
|
+
className: "relative w-full overflow-x-auto",
|
|
136
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
137
|
+
"data-slot": "table",
|
|
138
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
139
|
+
...props
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function TableHeader({ className,...props }) {
|
|
144
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
145
|
+
"data-slot": "table-header",
|
|
146
|
+
className: cn("[&_tr]:border-b", className),
|
|
147
|
+
...props
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function TableBody({ className,...props }) {
|
|
151
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
152
|
+
"data-slot": "table-body",
|
|
153
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
154
|
+
...props
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function TableRow({ className,...props }) {
|
|
158
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
159
|
+
"data-slot": "table-row",
|
|
160
|
+
className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
161
|
+
...props
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function TableHead({ className,...props }) {
|
|
165
|
+
return /* @__PURE__ */ jsx("th", {
|
|
166
|
+
"data-slot": "table-head",
|
|
167
|
+
className: cn("h-10 whitespace-nowrap px-2 text-left align-middle font-medium text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
168
|
+
...props
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function TableCell({ className,...props }) {
|
|
172
|
+
return /* @__PURE__ */ jsx("td", {
|
|
173
|
+
"data-slot": "table-cell",
|
|
174
|
+
className: cn("whitespace-nowrap p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
175
|
+
...props
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
130
179
|
//#endregion
|
|
131
180
|
//#region src/config/data-table.ts
|
|
132
181
|
const dataTableConfig = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordrhyme/auto-crud",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.2",
|
|
5
|
+
"packageManager": "pnpm@10.25.0",
|
|
5
6
|
"description": "Schema-first CRUD components with auto-generated tables and forms",
|
|
6
7
|
"author": "wordrhyme",
|
|
7
8
|
"license": "MIT",
|
|
@@ -26,6 +27,20 @@
|
|
|
26
27
|
"publishConfig": {
|
|
27
28
|
"access": "public"
|
|
28
29
|
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"prepublishOnly": "pnpm run clean && pnpm run build",
|
|
32
|
+
"clean": "git clean -xdf .cache .turbo dist",
|
|
33
|
+
"clean:all": "git clean -xdf .cache .turbo dist node_modules",
|
|
34
|
+
"build": "tsdown",
|
|
35
|
+
"build:watch": "tsdown --watch",
|
|
36
|
+
"test": "vitest --run --passWithNoTests",
|
|
37
|
+
"test:watch": "vitest --watch",
|
|
38
|
+
"test:ui": "vitest --ui",
|
|
39
|
+
"test:coverage": "vitest --coverage",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"lint": "eslint",
|
|
42
|
+
"format": "prettier --check . --ignore-path ../../.gitignore --ignore-path ../../.prettierignore"
|
|
43
|
+
},
|
|
29
44
|
"peerDependencies": {
|
|
30
45
|
"react": "^18.0.0 || ^19.0.0",
|
|
31
46
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
@@ -41,6 +56,9 @@
|
|
|
41
56
|
"@formily/json-schema": "^2.3.7",
|
|
42
57
|
"@formily/react": "^2.3.7",
|
|
43
58
|
"@formily/reactive": "^2.3.7",
|
|
59
|
+
"@pixpilot/formily-shadcn": "workspace:*",
|
|
60
|
+
"@pixpilot/shadcn": "workspace:*",
|
|
61
|
+
"@pixpilot/shadcn-ui": "workspace:*",
|
|
44
62
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
45
63
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
46
64
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
@@ -59,46 +77,30 @@
|
|
|
59
77
|
"@tanstack/react-table": "^8.21.3",
|
|
60
78
|
"@tanstack/react-virtual": "^3.13.18",
|
|
61
79
|
"class-variance-authority": "^0.7.1",
|
|
62
|
-
"clsx": "
|
|
80
|
+
"clsx": "catalog:prod",
|
|
63
81
|
"cmdk": "^1.1.1",
|
|
64
|
-
"lucide-react": "
|
|
82
|
+
"lucide-react": "catalog:prod",
|
|
65
83
|
"nanoid": "^5.1.6",
|
|
66
|
-
"tailwind-merge": "
|
|
67
|
-
"vaul": "^1.1.2"
|
|
68
|
-
"@pixpilot/formily-shadcn": "0.44.3",
|
|
69
|
-
"@pixpilot/shadcn-ui": "0.47.0",
|
|
70
|
-
"@pixpilot/shadcn": "0.9.0"
|
|
84
|
+
"tailwind-merge": "catalog:prod",
|
|
85
|
+
"vaul": "^1.1.2"
|
|
71
86
|
},
|
|
72
87
|
"devDependencies": {
|
|
88
|
+
"@internal/eslint-config": "workspace:*",
|
|
89
|
+
"@internal/prettier-config": "workspace:*",
|
|
90
|
+
"@internal/tsconfig": "workspace:*",
|
|
91
|
+
"@internal/tsdown-config": "workspace:*",
|
|
92
|
+
"@internal/vitest-config": "workspace:*",
|
|
73
93
|
"@tanstack/react-query": "^5.90.15",
|
|
74
94
|
"@trpc/server": "^11.0.0",
|
|
75
|
-
"@types/node": "
|
|
76
|
-
"@types/react": "
|
|
77
|
-
"@types/react-dom": "
|
|
95
|
+
"@types/node": "catalog:dev",
|
|
96
|
+
"@types/react": "catalog:dev",
|
|
97
|
+
"@types/react-dom": "catalog:dev",
|
|
78
98
|
"drizzle-orm": "^0.45.1",
|
|
79
|
-
"eslint": "
|
|
80
|
-
"react": "
|
|
81
|
-
"react-dom": "
|
|
82
|
-
"tsdown": "
|
|
83
|
-
"typescript": "
|
|
84
|
-
"@internal/tsconfig": "0.1.0",
|
|
85
|
-
"@internal/eslint-config": "0.3.0",
|
|
86
|
-
"@internal/tsdown-config": "0.1.0",
|
|
87
|
-
"@internal/prettier-config": "0.0.1",
|
|
88
|
-
"@internal/vitest-config": "0.1.0"
|
|
99
|
+
"eslint": "catalog:dev",
|
|
100
|
+
"react": "catalog:prod",
|
|
101
|
+
"react-dom": "catalog:prod",
|
|
102
|
+
"tsdown": "catalog:dev",
|
|
103
|
+
"typescript": "catalog:dev"
|
|
89
104
|
},
|
|
90
|
-
"prettier": "@internal/prettier-config"
|
|
91
|
-
|
|
92
|
-
"clean": "git clean -xdf .cache .turbo dist",
|
|
93
|
-
"clean:all": "git clean -xdf .cache .turbo dist node_modules",
|
|
94
|
-
"build": "tsdown",
|
|
95
|
-
"build:watch": "tsdown --watch",
|
|
96
|
-
"test": "vitest --run --passWithNoTests",
|
|
97
|
-
"test:watch": "vitest --watch",
|
|
98
|
-
"test:ui": "vitest --ui",
|
|
99
|
-
"test:coverage": "vitest --coverage",
|
|
100
|
-
"typecheck": "tsc --noEmit",
|
|
101
|
-
"lint": "eslint",
|
|
102
|
-
"format": "prettier --check . --ignore-path ../../.gitignore --ignore-path ../../.prettierignore"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
+
"prettier": "@internal/prettier-config"
|
|
106
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Pixpilot
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|