@wordrhyme/auto-crud 1.0.5 → 1.0.6
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 +4 -4
- package/dist/index.d.cts +25 -17
- package/dist/index.d.ts +25 -17
- package/dist/index.js +4 -4
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -5980,7 +5980,7 @@ function resolveActions(items, defaults, rowActionsLocale) {
|
|
|
5980
5980
|
*
|
|
5981
5981
|
* 高级 CRUD 表格组件,封装了完整的增删改查流程
|
|
5982
5982
|
*/
|
|
5983
|
-
function AutoCrudTable({ title, description, schema, resource, fields, table: tableConfig, form: formConfig, slots, permissions, actions: actionItems, locale: localeProp }) {
|
|
5983
|
+
function AutoCrudTable({ title, description, schema, resource, fields, table: tableConfig, form: formConfig, slots, permissions, actions: actionItems, locale: localeProp, onCreate }) {
|
|
5984
5984
|
const locale = resolveLocale(localeProp);
|
|
5985
5985
|
const can = {
|
|
5986
5986
|
create: permissions?.can?.create ?? true,
|
|
@@ -6083,10 +6083,10 @@ function AutoCrudTable({ title, description, schema, resource, fields, table: ta
|
|
|
6083
6083
|
disabled: exporting || selectedCount === 0 && !resource.handlers.export,
|
|
6084
6084
|
children: [exporting ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Upload, { className: "mr-2 h-4 w-4" }), selectedCount > 0 ? locale.toolbar.exportSelected(selectedCount) : locale.toolbar.export]
|
|
6085
6085
|
}),
|
|
6086
|
-
can.create && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
6087
|
-
onClick: resource.handlers.openCreate,
|
|
6086
|
+
can.create && (slots?.createButton ? slots.createButton : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
6087
|
+
onClick: onCreate ?? resource.handlers.openCreate,
|
|
6088
6088
|
children: locale.toolbar.create
|
|
6089
|
-
})
|
|
6089
|
+
}))
|
|
6090
6090
|
]
|
|
6091
6091
|
})]
|
|
6092
6092
|
}),
|
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";
|
|
@@ -314,7 +314,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
314
314
|
enableExport,
|
|
315
315
|
enableDelete,
|
|
316
316
|
extraActions
|
|
317
|
-
}: AutoTableActionBarProps<TData>):
|
|
317
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/lib/schema-bridge/types.d.ts
|
|
320
320
|
/**
|
|
@@ -470,7 +470,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
470
470
|
enableExport,
|
|
471
471
|
onSelectedCountChange,
|
|
472
472
|
getSelectedRows
|
|
473
|
-
}: AutoTableProps<T>):
|
|
473
|
+
}: AutoTableProps<T>): react_jsx_runtime3.JSX.Element;
|
|
474
474
|
//#endregion
|
|
475
475
|
//#region src/i18n/locale.d.ts
|
|
476
476
|
/**
|
|
@@ -714,6 +714,8 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
714
714
|
toolbarStart?: React$1.ReactNode;
|
|
715
715
|
/** 工具栏右侧插槽 */
|
|
716
716
|
toolbarEnd?: React$1.ReactNode;
|
|
717
|
+
/** 覆盖内置的新建按钮组件 */
|
|
718
|
+
createButton?: React$1.ReactNode;
|
|
717
719
|
};
|
|
718
720
|
/** 行操作配置,见 {@link ActionItem} */
|
|
719
721
|
actions?: ActionItem<z.output<TSchema>>[];
|
|
@@ -750,6 +752,11 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
750
752
|
* ```
|
|
751
753
|
*/
|
|
752
754
|
locale?: LocaleProp;
|
|
755
|
+
/**
|
|
756
|
+
* 自定义新建按钮点击事件
|
|
757
|
+
* 如果提供,将覆盖默认的打开新建弹窗行为
|
|
758
|
+
*/
|
|
759
|
+
onCreate?: () => void;
|
|
753
760
|
}
|
|
754
761
|
/**
|
|
755
762
|
* AutoCrudTable 组件
|
|
@@ -767,8 +774,9 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
767
774
|
slots,
|
|
768
775
|
permissions,
|
|
769
776
|
actions: actionItems,
|
|
770
|
-
locale: localeProp
|
|
771
|
-
|
|
777
|
+
locale: localeProp,
|
|
778
|
+
onCreate
|
|
779
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime3.JSX.Element;
|
|
772
780
|
//#endregion
|
|
773
781
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
774
782
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -800,7 +808,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
800
808
|
labelAlign,
|
|
801
809
|
labelWidth,
|
|
802
810
|
showSubmitButton
|
|
803
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
811
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime3.JSX.Element;
|
|
804
812
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
805
813
|
ref?: React.Ref<AutoFormRef>;
|
|
806
814
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1098,7 +1106,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1098
1106
|
shallow,
|
|
1099
1107
|
filters: externalFilters,
|
|
1100
1108
|
onFiltersChange
|
|
1101
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1109
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime3.JSX.Element | null;
|
|
1102
1110
|
//#endregion
|
|
1103
1111
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1104
1112
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1140,7 +1148,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1140
1148
|
labelAlign,
|
|
1141
1149
|
labelWidth,
|
|
1142
1150
|
className
|
|
1143
|
-
}: CrudFormModalProps<T>):
|
|
1151
|
+
}: CrudFormModalProps<T>): react_jsx_runtime3.JSX.Element;
|
|
1144
1152
|
//#endregion
|
|
1145
1153
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1146
1154
|
interface ImportDialogProps {
|
|
@@ -1162,7 +1170,7 @@ declare function ImportDialog({
|
|
|
1162
1170
|
columns,
|
|
1163
1171
|
title,
|
|
1164
1172
|
locale
|
|
1165
|
-
}: ImportDialogProps):
|
|
1173
|
+
}: ImportDialogProps): react_jsx_runtime3.JSX.Element;
|
|
1166
1174
|
//#endregion
|
|
1167
1175
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1168
1176
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1182,7 +1190,7 @@ declare function ExportDialog({
|
|
|
1182
1190
|
selectedCount,
|
|
1183
1191
|
onExport,
|
|
1184
1192
|
canExportFiltered
|
|
1185
|
-
}: ExportDialogProps):
|
|
1193
|
+
}: ExportDialogProps): react_jsx_runtime3.JSX.Element;
|
|
1186
1194
|
//#endregion
|
|
1187
1195
|
//#region src/components/data-table/data-table.d.ts
|
|
1188
1196
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1195,7 +1203,7 @@ declare function DataTable<TData>({
|
|
|
1195
1203
|
children,
|
|
1196
1204
|
className,
|
|
1197
1205
|
...props
|
|
1198
|
-
}: DataTableProps<TData>):
|
|
1206
|
+
}: DataTableProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1199
1207
|
//#endregion
|
|
1200
1208
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1201
1209
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1206,7 +1214,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1206
1214
|
children,
|
|
1207
1215
|
className,
|
|
1208
1216
|
...props
|
|
1209
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1217
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1210
1218
|
//#endregion
|
|
1211
1219
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1212
1220
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1218,7 +1226,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1218
1226
|
label,
|
|
1219
1227
|
className,
|
|
1220
1228
|
...props
|
|
1221
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1229
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
1222
1230
|
//#endregion
|
|
1223
1231
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1224
1232
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1232,7 +1240,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1232
1240
|
title,
|
|
1233
1241
|
options,
|
|
1234
1242
|
multiple
|
|
1235
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1243
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
1236
1244
|
//#endregion
|
|
1237
1245
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1238
1246
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1244,7 +1252,7 @@ declare function DataTablePagination<TData>({
|
|
|
1244
1252
|
pageSizeOptions,
|
|
1245
1253
|
className,
|
|
1246
1254
|
...props
|
|
1247
|
-
}: DataTablePaginationProps<TData>):
|
|
1255
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1248
1256
|
//#endregion
|
|
1249
1257
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1250
1258
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1255,7 +1263,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1255
1263
|
children,
|
|
1256
1264
|
className,
|
|
1257
1265
|
...props
|
|
1258
|
-
}: DataTableToolbarProps<TData>):
|
|
1266
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1259
1267
|
//#endregion
|
|
1260
1268
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1261
1269
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1266,7 +1274,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1266
1274
|
table,
|
|
1267
1275
|
disabled,
|
|
1268
1276
|
...props
|
|
1269
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1277
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1270
1278
|
//#endregion
|
|
1271
1279
|
//#region src/hooks/use-data-table.d.ts
|
|
1272
1280
|
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_runtime4 from "react/jsx-runtime";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { ISchema } from "@formily/json-schema";
|
|
9
9
|
|
|
@@ -314,7 +314,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
314
314
|
enableExport,
|
|
315
315
|
enableDelete,
|
|
316
316
|
extraActions
|
|
317
|
-
}: AutoTableActionBarProps<TData>):
|
|
317
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/lib/schema-bridge/types.d.ts
|
|
320
320
|
/**
|
|
@@ -470,7 +470,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
470
470
|
enableExport,
|
|
471
471
|
onSelectedCountChange,
|
|
472
472
|
getSelectedRows
|
|
473
|
-
}: AutoTableProps<T>):
|
|
473
|
+
}: AutoTableProps<T>): react_jsx_runtime4.JSX.Element;
|
|
474
474
|
//#endregion
|
|
475
475
|
//#region src/i18n/locale.d.ts
|
|
476
476
|
/**
|
|
@@ -714,6 +714,8 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
714
714
|
toolbarStart?: React$1.ReactNode;
|
|
715
715
|
/** 工具栏右侧插槽 */
|
|
716
716
|
toolbarEnd?: React$1.ReactNode;
|
|
717
|
+
/** 覆盖内置的新建按钮组件 */
|
|
718
|
+
createButton?: React$1.ReactNode;
|
|
717
719
|
};
|
|
718
720
|
/** 行操作配置,见 {@link ActionItem} */
|
|
719
721
|
actions?: ActionItem<z.output<TSchema>>[];
|
|
@@ -750,6 +752,11 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
750
752
|
* ```
|
|
751
753
|
*/
|
|
752
754
|
locale?: LocaleProp;
|
|
755
|
+
/**
|
|
756
|
+
* 自定义新建按钮点击事件
|
|
757
|
+
* 如果提供,将覆盖默认的打开新建弹窗行为
|
|
758
|
+
*/
|
|
759
|
+
onCreate?: () => void;
|
|
753
760
|
}
|
|
754
761
|
/**
|
|
755
762
|
* AutoCrudTable 组件
|
|
@@ -767,8 +774,9 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
767
774
|
slots,
|
|
768
775
|
permissions,
|
|
769
776
|
actions: actionItems,
|
|
770
|
-
locale: localeProp
|
|
771
|
-
|
|
777
|
+
locale: localeProp,
|
|
778
|
+
onCreate
|
|
779
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime4.JSX.Element;
|
|
772
780
|
//#endregion
|
|
773
781
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
774
782
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -800,7 +808,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
800
808
|
labelAlign,
|
|
801
809
|
labelWidth,
|
|
802
810
|
showSubmitButton
|
|
803
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
811
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime4.JSX.Element;
|
|
804
812
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
805
813
|
ref?: React.Ref<AutoFormRef>;
|
|
806
814
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1098,7 +1106,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1098
1106
|
shallow,
|
|
1099
1107
|
filters: externalFilters,
|
|
1100
1108
|
onFiltersChange
|
|
1101
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1109
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime4.JSX.Element | null;
|
|
1102
1110
|
//#endregion
|
|
1103
1111
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1104
1112
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1140,7 +1148,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1140
1148
|
labelAlign,
|
|
1141
1149
|
labelWidth,
|
|
1142
1150
|
className
|
|
1143
|
-
}: CrudFormModalProps<T>):
|
|
1151
|
+
}: CrudFormModalProps<T>): react_jsx_runtime4.JSX.Element;
|
|
1144
1152
|
//#endregion
|
|
1145
1153
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1146
1154
|
interface ImportDialogProps {
|
|
@@ -1162,7 +1170,7 @@ declare function ImportDialog({
|
|
|
1162
1170
|
columns,
|
|
1163
1171
|
title,
|
|
1164
1172
|
locale
|
|
1165
|
-
}: ImportDialogProps):
|
|
1173
|
+
}: ImportDialogProps): react_jsx_runtime4.JSX.Element;
|
|
1166
1174
|
//#endregion
|
|
1167
1175
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1168
1176
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1182,7 +1190,7 @@ declare function ExportDialog({
|
|
|
1182
1190
|
selectedCount,
|
|
1183
1191
|
onExport,
|
|
1184
1192
|
canExportFiltered
|
|
1185
|
-
}: ExportDialogProps):
|
|
1193
|
+
}: ExportDialogProps): react_jsx_runtime4.JSX.Element;
|
|
1186
1194
|
//#endregion
|
|
1187
1195
|
//#region src/components/data-table/data-table.d.ts
|
|
1188
1196
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1195,7 +1203,7 @@ declare function DataTable<TData>({
|
|
|
1195
1203
|
children,
|
|
1196
1204
|
className,
|
|
1197
1205
|
...props
|
|
1198
|
-
}: DataTableProps<TData>):
|
|
1206
|
+
}: DataTableProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1199
1207
|
//#endregion
|
|
1200
1208
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1201
1209
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1206,7 +1214,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1206
1214
|
children,
|
|
1207
1215
|
className,
|
|
1208
1216
|
...props
|
|
1209
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1217
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1210
1218
|
//#endregion
|
|
1211
1219
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1212
1220
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1218,7 +1226,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1218
1226
|
label,
|
|
1219
1227
|
className,
|
|
1220
1228
|
...props
|
|
1221
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1229
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime4.JSX.Element;
|
|
1222
1230
|
//#endregion
|
|
1223
1231
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1224
1232
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1232,7 +1240,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1232
1240
|
title,
|
|
1233
1241
|
options,
|
|
1234
1242
|
multiple
|
|
1235
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1243
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime4.JSX.Element;
|
|
1236
1244
|
//#endregion
|
|
1237
1245
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1238
1246
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1244,7 +1252,7 @@ declare function DataTablePagination<TData>({
|
|
|
1244
1252
|
pageSizeOptions,
|
|
1245
1253
|
className,
|
|
1246
1254
|
...props
|
|
1247
|
-
}: DataTablePaginationProps<TData>):
|
|
1255
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1248
1256
|
//#endregion
|
|
1249
1257
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1250
1258
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1255,7 +1263,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1255
1263
|
children,
|
|
1256
1264
|
className,
|
|
1257
1265
|
...props
|
|
1258
|
-
}: DataTableToolbarProps<TData>):
|
|
1266
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1259
1267
|
//#endregion
|
|
1260
1268
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1261
1269
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1266,7 +1274,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1266
1274
|
table,
|
|
1267
1275
|
disabled,
|
|
1268
1276
|
...props
|
|
1269
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1277
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1270
1278
|
//#endregion
|
|
1271
1279
|
//#region src/hooks/use-data-table.d.ts
|
|
1272
1280
|
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
package/dist/index.js
CHANGED
|
@@ -5938,7 +5938,7 @@ function resolveActions(items, defaults, rowActionsLocale) {
|
|
|
5938
5938
|
*
|
|
5939
5939
|
* 高级 CRUD 表格组件,封装了完整的增删改查流程
|
|
5940
5940
|
*/
|
|
5941
|
-
function AutoCrudTable({ title, description, schema, resource, fields, table: tableConfig, form: formConfig, slots, permissions, actions: actionItems, locale: localeProp }) {
|
|
5941
|
+
function AutoCrudTable({ title, description, schema, resource, fields, table: tableConfig, form: formConfig, slots, permissions, actions: actionItems, locale: localeProp, onCreate }) {
|
|
5942
5942
|
const locale = resolveLocale(localeProp);
|
|
5943
5943
|
const can = {
|
|
5944
5944
|
create: permissions?.can?.create ?? true,
|
|
@@ -6041,10 +6041,10 @@ function AutoCrudTable({ title, description, schema, resource, fields, table: ta
|
|
|
6041
6041
|
disabled: exporting || selectedCount === 0 && !resource.handlers.export,
|
|
6042
6042
|
children: [exporting ? /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Upload, { className: "mr-2 h-4 w-4" }), selectedCount > 0 ? locale.toolbar.exportSelected(selectedCount) : locale.toolbar.export]
|
|
6043
6043
|
}),
|
|
6044
|
-
can.create && /* @__PURE__ */ jsx(Button, {
|
|
6045
|
-
onClick: resource.handlers.openCreate,
|
|
6044
|
+
can.create && (slots?.createButton ? slots.createButton : /* @__PURE__ */ jsx(Button, {
|
|
6045
|
+
onClick: onCreate ?? resource.handlers.openCreate,
|
|
6046
6046
|
children: locale.toolbar.create
|
|
6047
|
-
})
|
|
6047
|
+
}))
|
|
6048
6048
|
]
|
|
6049
6049
|
})]
|
|
6050
6050
|
}),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordrhyme/auto-crud",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"description": "Schema-first CRUD components with auto-generated tables and forms",
|
|
6
6
|
"author": "wordrhyme",
|
|
7
7
|
"license": "MIT",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"@internal/eslint-config": "0.3.0",
|
|
85
85
|
"@internal/prettier-config": "0.0.1",
|
|
86
86
|
"@internal/tsconfig": "0.1.0",
|
|
87
|
-
"@internal/
|
|
88
|
-
"@internal/
|
|
87
|
+
"@internal/vitest-config": "0.1.0",
|
|
88
|
+
"@internal/tsdown-config": "0.1.0"
|
|
89
89
|
},
|
|
90
90
|
"prettier": "@internal/prettier-config",
|
|
91
91
|
"scripts": {
|