@wordrhyme/auto-crud 1.0.3 → 1.0.5
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 +9 -7
- package/dist/index.d.cts +26 -21
- package/dist/index.d.ts +26 -21
- package/dist/index.js +9 -7
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -4726,14 +4726,14 @@ function FormModal({ open, onOpenChange, title, description, children, variant =
|
|
|
4726
4726
|
onOpenChange,
|
|
4727
4727
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.SheetContent, {
|
|
4728
4728
|
side,
|
|
4729
|
-
className:
|
|
4729
|
+
className: cn("sm:max-w-lg flex flex-col p-0", className),
|
|
4730
4730
|
children: [
|
|
4731
4731
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.SheetHeader, {
|
|
4732
4732
|
className: "flex-shrink-0 px-6 pt-6",
|
|
4733
4733
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SheetTitle, { children: title }), description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SheetDescription, { children: description })]
|
|
4734
4734
|
}),
|
|
4735
4735
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4736
|
-
className: "flex-1 overflow-auto",
|
|
4736
|
+
className: "flex-1 overflow-y-auto min-h-0",
|
|
4737
4737
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4738
4738
|
className: "px-6 py-4",
|
|
4739
4739
|
children
|
|
@@ -4750,16 +4750,16 @@ function FormModal({ open, onOpenChange, title, description, children, variant =
|
|
|
4750
4750
|
open,
|
|
4751
4751
|
onOpenChange,
|
|
4752
4752
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DialogContent, {
|
|
4753
|
-
className:
|
|
4753
|
+
className: cn("max-w-2xl sm:max-w-2xl flex flex-col max-h-[85vh] overflow-hidden p-0", className),
|
|
4754
4754
|
children: [
|
|
4755
4755
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DialogHeader, {
|
|
4756
4756
|
className: "flex-shrink-0 px-6 pt-6",
|
|
4757
4757
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DialogTitle, { children: title }), description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DialogDescription, { children: description })]
|
|
4758
4758
|
}),
|
|
4759
4759
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4760
|
-
className: "flex-1 overflow-auto",
|
|
4760
|
+
className: "flex-1 overflow-y-auto min-h-0",
|
|
4761
4761
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4762
|
-
className: "px-6 py-4",
|
|
4762
|
+
className: "px-6 py-4 text-sm",
|
|
4763
4763
|
children
|
|
4764
4764
|
})
|
|
4765
4765
|
}),
|
|
@@ -5374,7 +5374,7 @@ function resolveLocale(localeProp) {
|
|
|
5374
5374
|
|
|
5375
5375
|
//#endregion
|
|
5376
5376
|
//#region src/components/auto-crud/crud-form-modal.tsx
|
|
5377
|
-
function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubmit, loading = false, variant = "dialog", overrides, title, locale = zhCN.formModal, gridColumns, labelAlign, labelWidth }) {
|
|
5377
|
+
function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubmit, loading = false, variant = "dialog", overrides, title, locale = zhCN.formModal, gridColumns, labelAlign, labelWidth, className }) {
|
|
5378
5378
|
const defaultTitle = mode === "create" ? locale.createTitle : locale.editTitle;
|
|
5379
5379
|
const formRef = (0, react.useRef)(null);
|
|
5380
5380
|
const handleSubmit = async () => {
|
|
@@ -5385,6 +5385,7 @@ function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubm
|
|
|
5385
5385
|
onOpenChange,
|
|
5386
5386
|
title: title ?? defaultTitle,
|
|
5387
5387
|
variant,
|
|
5388
|
+
className,
|
|
5388
5389
|
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5389
5390
|
className: "flex justify-end gap-2",
|
|
5390
5391
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
@@ -6124,7 +6125,8 @@ function AutoCrudTable({ title, description, schema, resource, fields, table: ta
|
|
|
6124
6125
|
variant: resource.modal.variant,
|
|
6125
6126
|
overrides: formOverrides,
|
|
6126
6127
|
locale: locale.formModal,
|
|
6127
|
-
gridColumns: formConfig?.columns
|
|
6128
|
+
gridColumns: formConfig?.columns,
|
|
6129
|
+
className: formConfig?.className
|
|
6128
6130
|
}),
|
|
6129
6131
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ViewModal, {
|
|
6130
6132
|
open: resource.modal.viewOpen,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 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_runtime5.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_runtime5.JSX.Element;
|
|
474
474
|
//#endregion
|
|
475
475
|
//#region src/i18n/locale.d.ts
|
|
476
476
|
/**
|
|
@@ -701,10 +701,12 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
701
701
|
};
|
|
702
702
|
/** 表单配置 */
|
|
703
703
|
form?: {
|
|
704
|
-
/**
|
|
704
|
+
/** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
|
|
705
705
|
overrides?: Record<string, any>;
|
|
706
706
|
/** 表单列数 */
|
|
707
707
|
columns?: number;
|
|
708
|
+
/** 弹窗自定义容器类名(支持控制大小、最大高度等) */
|
|
709
|
+
className?: string;
|
|
708
710
|
};
|
|
709
711
|
/** 扩展点 */
|
|
710
712
|
slots?: {
|
|
@@ -766,7 +768,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
766
768
|
permissions,
|
|
767
769
|
actions: actionItems,
|
|
768
770
|
locale: localeProp
|
|
769
|
-
}: AutoCrudTableProps<TSchema>):
|
|
771
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime5.JSX.Element;
|
|
770
772
|
//#endregion
|
|
771
773
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
772
774
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -798,7 +800,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
798
800
|
labelAlign,
|
|
799
801
|
labelWidth,
|
|
800
802
|
showSubmitButton
|
|
801
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
803
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime5.JSX.Element;
|
|
802
804
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
803
805
|
ref?: React.Ref<AutoFormRef>;
|
|
804
806
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1012,12 +1014,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
1012
1014
|
variant: z.ZodEnum<{
|
|
1013
1015
|
number: "number";
|
|
1014
1016
|
boolean: "boolean";
|
|
1015
|
-
date: "date";
|
|
1016
1017
|
text: "text";
|
|
1018
|
+
range: "range";
|
|
1019
|
+
date: "date";
|
|
1020
|
+
dateRange: "dateRange";
|
|
1017
1021
|
select: "select";
|
|
1018
1022
|
multiSelect: "multiSelect";
|
|
1019
|
-
dateRange: "dateRange";
|
|
1020
|
-
range: "range";
|
|
1021
1023
|
}>;
|
|
1022
1024
|
operator: z.ZodEnum<{
|
|
1023
1025
|
iLike: "iLike";
|
|
@@ -1096,7 +1098,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1096
1098
|
shallow,
|
|
1097
1099
|
filters: externalFilters,
|
|
1098
1100
|
onFiltersChange
|
|
1099
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1101
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime5.JSX.Element | null;
|
|
1100
1102
|
//#endregion
|
|
1101
1103
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1102
1104
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1119,6 +1121,8 @@ interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
1119
1121
|
labelAlign?: "left" | "top" | "right";
|
|
1120
1122
|
/** Label 宽度(labelAlign 为 left 时有效) */
|
|
1121
1123
|
labelWidth?: number | string;
|
|
1124
|
+
/** 弹窗自定义样式 */
|
|
1125
|
+
className?: string;
|
|
1122
1126
|
}
|
|
1123
1127
|
declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
1124
1128
|
open,
|
|
@@ -1134,8 +1138,9 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1134
1138
|
locale,
|
|
1135
1139
|
gridColumns,
|
|
1136
1140
|
labelAlign,
|
|
1137
|
-
labelWidth
|
|
1138
|
-
|
|
1141
|
+
labelWidth,
|
|
1142
|
+
className
|
|
1143
|
+
}: CrudFormModalProps<T>): react_jsx_runtime5.JSX.Element;
|
|
1139
1144
|
//#endregion
|
|
1140
1145
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1141
1146
|
interface ImportDialogProps {
|
|
@@ -1157,7 +1162,7 @@ declare function ImportDialog({
|
|
|
1157
1162
|
columns,
|
|
1158
1163
|
title,
|
|
1159
1164
|
locale
|
|
1160
|
-
}: ImportDialogProps):
|
|
1165
|
+
}: ImportDialogProps): react_jsx_runtime5.JSX.Element;
|
|
1161
1166
|
//#endregion
|
|
1162
1167
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1163
1168
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1177,7 +1182,7 @@ declare function ExportDialog({
|
|
|
1177
1182
|
selectedCount,
|
|
1178
1183
|
onExport,
|
|
1179
1184
|
canExportFiltered
|
|
1180
|
-
}: ExportDialogProps):
|
|
1185
|
+
}: ExportDialogProps): react_jsx_runtime5.JSX.Element;
|
|
1181
1186
|
//#endregion
|
|
1182
1187
|
//#region src/components/data-table/data-table.d.ts
|
|
1183
1188
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1190,7 +1195,7 @@ declare function DataTable<TData>({
|
|
|
1190
1195
|
children,
|
|
1191
1196
|
className,
|
|
1192
1197
|
...props
|
|
1193
|
-
}: DataTableProps<TData>):
|
|
1198
|
+
}: DataTableProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1194
1199
|
//#endregion
|
|
1195
1200
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1196
1201
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1201,7 +1206,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1201
1206
|
children,
|
|
1202
1207
|
className,
|
|
1203
1208
|
...props
|
|
1204
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1209
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1205
1210
|
//#endregion
|
|
1206
1211
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1207
1212
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1213,7 +1218,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1213
1218
|
label,
|
|
1214
1219
|
className,
|
|
1215
1220
|
...props
|
|
1216
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1221
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime5.JSX.Element;
|
|
1217
1222
|
//#endregion
|
|
1218
1223
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1219
1224
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1227,7 +1232,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1227
1232
|
title,
|
|
1228
1233
|
options,
|
|
1229
1234
|
multiple
|
|
1230
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1235
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime5.JSX.Element;
|
|
1231
1236
|
//#endregion
|
|
1232
1237
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1233
1238
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1239,7 +1244,7 @@ declare function DataTablePagination<TData>({
|
|
|
1239
1244
|
pageSizeOptions,
|
|
1240
1245
|
className,
|
|
1241
1246
|
...props
|
|
1242
|
-
}: DataTablePaginationProps<TData>):
|
|
1247
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1243
1248
|
//#endregion
|
|
1244
1249
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1245
1250
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1250,7 +1255,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1250
1255
|
children,
|
|
1251
1256
|
className,
|
|
1252
1257
|
...props
|
|
1253
|
-
}: DataTableToolbarProps<TData>):
|
|
1258
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1254
1259
|
//#endregion
|
|
1255
1260
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1256
1261
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1261,7 +1266,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1261
1266
|
table,
|
|
1262
1267
|
disabled,
|
|
1263
1268
|
...props
|
|
1264
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1269
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1265
1270
|
//#endregion
|
|
1266
1271
|
//#region src/hooks/use-data-table.d.ts
|
|
1267
1272
|
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_runtime10 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_runtime10.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_runtime10.JSX.Element;
|
|
474
474
|
//#endregion
|
|
475
475
|
//#region src/i18n/locale.d.ts
|
|
476
476
|
/**
|
|
@@ -701,10 +701,12 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
701
701
|
};
|
|
702
702
|
/** 表单配置 */
|
|
703
703
|
form?: {
|
|
704
|
-
/**
|
|
704
|
+
/** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
|
|
705
705
|
overrides?: Record<string, any>;
|
|
706
706
|
/** 表单列数 */
|
|
707
707
|
columns?: number;
|
|
708
|
+
/** 弹窗自定义容器类名(支持控制大小、最大高度等) */
|
|
709
|
+
className?: string;
|
|
708
710
|
};
|
|
709
711
|
/** 扩展点 */
|
|
710
712
|
slots?: {
|
|
@@ -766,7 +768,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
766
768
|
permissions,
|
|
767
769
|
actions: actionItems,
|
|
768
770
|
locale: localeProp
|
|
769
|
-
}: AutoCrudTableProps<TSchema>):
|
|
771
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime10.JSX.Element;
|
|
770
772
|
//#endregion
|
|
771
773
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
772
774
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -798,7 +800,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
798
800
|
labelAlign,
|
|
799
801
|
labelWidth,
|
|
800
802
|
showSubmitButton
|
|
801
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
803
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime10.JSX.Element;
|
|
802
804
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
803
805
|
ref?: React.Ref<AutoFormRef>;
|
|
804
806
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1012,12 +1014,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
1012
1014
|
variant: z.ZodEnum<{
|
|
1013
1015
|
number: "number";
|
|
1014
1016
|
boolean: "boolean";
|
|
1015
|
-
date: "date";
|
|
1016
1017
|
text: "text";
|
|
1018
|
+
range: "range";
|
|
1019
|
+
date: "date";
|
|
1020
|
+
dateRange: "dateRange";
|
|
1017
1021
|
select: "select";
|
|
1018
1022
|
multiSelect: "multiSelect";
|
|
1019
|
-
dateRange: "dateRange";
|
|
1020
|
-
range: "range";
|
|
1021
1023
|
}>;
|
|
1022
1024
|
operator: z.ZodEnum<{
|
|
1023
1025
|
iLike: "iLike";
|
|
@@ -1096,7 +1098,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1096
1098
|
shallow,
|
|
1097
1099
|
filters: externalFilters,
|
|
1098
1100
|
onFiltersChange
|
|
1099
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1101
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime10.JSX.Element | null;
|
|
1100
1102
|
//#endregion
|
|
1101
1103
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1102
1104
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1119,6 +1121,8 @@ interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
1119
1121
|
labelAlign?: "left" | "top" | "right";
|
|
1120
1122
|
/** Label 宽度(labelAlign 为 left 时有效) */
|
|
1121
1123
|
labelWidth?: number | string;
|
|
1124
|
+
/** 弹窗自定义样式 */
|
|
1125
|
+
className?: string;
|
|
1122
1126
|
}
|
|
1123
1127
|
declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
1124
1128
|
open,
|
|
@@ -1134,8 +1138,9 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1134
1138
|
locale,
|
|
1135
1139
|
gridColumns,
|
|
1136
1140
|
labelAlign,
|
|
1137
|
-
labelWidth
|
|
1138
|
-
|
|
1141
|
+
labelWidth,
|
|
1142
|
+
className
|
|
1143
|
+
}: CrudFormModalProps<T>): react_jsx_runtime10.JSX.Element;
|
|
1139
1144
|
//#endregion
|
|
1140
1145
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1141
1146
|
interface ImportDialogProps {
|
|
@@ -1157,7 +1162,7 @@ declare function ImportDialog({
|
|
|
1157
1162
|
columns,
|
|
1158
1163
|
title,
|
|
1159
1164
|
locale
|
|
1160
|
-
}: ImportDialogProps):
|
|
1165
|
+
}: ImportDialogProps): react_jsx_runtime10.JSX.Element;
|
|
1161
1166
|
//#endregion
|
|
1162
1167
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1163
1168
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1177,7 +1182,7 @@ declare function ExportDialog({
|
|
|
1177
1182
|
selectedCount,
|
|
1178
1183
|
onExport,
|
|
1179
1184
|
canExportFiltered
|
|
1180
|
-
}: ExportDialogProps):
|
|
1185
|
+
}: ExportDialogProps): react_jsx_runtime10.JSX.Element;
|
|
1181
1186
|
//#endregion
|
|
1182
1187
|
//#region src/components/data-table/data-table.d.ts
|
|
1183
1188
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1190,7 +1195,7 @@ declare function DataTable<TData>({
|
|
|
1190
1195
|
children,
|
|
1191
1196
|
className,
|
|
1192
1197
|
...props
|
|
1193
|
-
}: DataTableProps<TData>):
|
|
1198
|
+
}: DataTableProps<TData>): react_jsx_runtime10.JSX.Element;
|
|
1194
1199
|
//#endregion
|
|
1195
1200
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1196
1201
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1201,7 +1206,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1201
1206
|
children,
|
|
1202
1207
|
className,
|
|
1203
1208
|
...props
|
|
1204
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1209
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime10.JSX.Element;
|
|
1205
1210
|
//#endregion
|
|
1206
1211
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1207
1212
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1213,7 +1218,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1213
1218
|
label,
|
|
1214
1219
|
className,
|
|
1215
1220
|
...props
|
|
1216
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1221
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime10.JSX.Element;
|
|
1217
1222
|
//#endregion
|
|
1218
1223
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1219
1224
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1227,7 +1232,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1227
1232
|
title,
|
|
1228
1233
|
options,
|
|
1229
1234
|
multiple
|
|
1230
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1235
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime10.JSX.Element;
|
|
1231
1236
|
//#endregion
|
|
1232
1237
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1233
1238
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1239,7 +1244,7 @@ declare function DataTablePagination<TData>({
|
|
|
1239
1244
|
pageSizeOptions,
|
|
1240
1245
|
className,
|
|
1241
1246
|
...props
|
|
1242
|
-
}: DataTablePaginationProps<TData>):
|
|
1247
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime10.JSX.Element;
|
|
1243
1248
|
//#endregion
|
|
1244
1249
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1245
1250
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1250,7 +1255,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1250
1255
|
children,
|
|
1251
1256
|
className,
|
|
1252
1257
|
...props
|
|
1253
|
-
}: DataTableToolbarProps<TData>):
|
|
1258
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime10.JSX.Element;
|
|
1254
1259
|
//#endregion
|
|
1255
1260
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1256
1261
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1261,7 +1266,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1261
1266
|
table,
|
|
1262
1267
|
disabled,
|
|
1263
1268
|
...props
|
|
1264
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1269
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime10.JSX.Element;
|
|
1265
1270
|
//#endregion
|
|
1266
1271
|
//#region src/hooks/use-data-table.d.ts
|
|
1267
1272
|
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
package/dist/index.js
CHANGED
|
@@ -4684,14 +4684,14 @@ function FormModal({ open, onOpenChange, title, description, children, variant =
|
|
|
4684
4684
|
onOpenChange,
|
|
4685
4685
|
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
4686
4686
|
side,
|
|
4687
|
-
className:
|
|
4687
|
+
className: cn("sm:max-w-lg flex flex-col p-0", className),
|
|
4688
4688
|
children: [
|
|
4689
4689
|
/* @__PURE__ */ jsxs(SheetHeader, {
|
|
4690
4690
|
className: "flex-shrink-0 px-6 pt-6",
|
|
4691
4691
|
children: [/* @__PURE__ */ jsx(SheetTitle, { children: title }), description && /* @__PURE__ */ jsx(SheetDescription, { children: description })]
|
|
4692
4692
|
}),
|
|
4693
4693
|
/* @__PURE__ */ jsx("div", {
|
|
4694
|
-
className: "flex-1 overflow-auto",
|
|
4694
|
+
className: "flex-1 overflow-y-auto min-h-0",
|
|
4695
4695
|
children: /* @__PURE__ */ jsx("div", {
|
|
4696
4696
|
className: "px-6 py-4",
|
|
4697
4697
|
children
|
|
@@ -4708,16 +4708,16 @@ function FormModal({ open, onOpenChange, title, description, children, variant =
|
|
|
4708
4708
|
open,
|
|
4709
4709
|
onOpenChange,
|
|
4710
4710
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
4711
|
-
className:
|
|
4711
|
+
className: cn("max-w-2xl sm:max-w-2xl flex flex-col max-h-[85vh] overflow-hidden p-0", className),
|
|
4712
4712
|
children: [
|
|
4713
4713
|
/* @__PURE__ */ jsxs(DialogHeader, {
|
|
4714
4714
|
className: "flex-shrink-0 px-6 pt-6",
|
|
4715
4715
|
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), description && /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
4716
4716
|
}),
|
|
4717
4717
|
/* @__PURE__ */ jsx("div", {
|
|
4718
|
-
className: "flex-1 overflow-auto",
|
|
4718
|
+
className: "flex-1 overflow-y-auto min-h-0",
|
|
4719
4719
|
children: /* @__PURE__ */ jsx("div", {
|
|
4720
|
-
className: "px-6 py-4",
|
|
4720
|
+
className: "px-6 py-4 text-sm",
|
|
4721
4721
|
children
|
|
4722
4722
|
})
|
|
4723
4723
|
}),
|
|
@@ -5332,7 +5332,7 @@ function resolveLocale(localeProp) {
|
|
|
5332
5332
|
|
|
5333
5333
|
//#endregion
|
|
5334
5334
|
//#region src/components/auto-crud/crud-form-modal.tsx
|
|
5335
|
-
function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubmit, loading = false, variant = "dialog", overrides, title, locale = zhCN.formModal, gridColumns, labelAlign, labelWidth }) {
|
|
5335
|
+
function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubmit, loading = false, variant = "dialog", overrides, title, locale = zhCN.formModal, gridColumns, labelAlign, labelWidth, className }) {
|
|
5336
5336
|
const defaultTitle = mode === "create" ? locale.createTitle : locale.editTitle;
|
|
5337
5337
|
const formRef = useRef(null);
|
|
5338
5338
|
const handleSubmit = async () => {
|
|
@@ -5343,6 +5343,7 @@ function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubm
|
|
|
5343
5343
|
onOpenChange,
|
|
5344
5344
|
title: title ?? defaultTitle,
|
|
5345
5345
|
variant,
|
|
5346
|
+
className,
|
|
5346
5347
|
footer: /* @__PURE__ */ jsxs("div", {
|
|
5347
5348
|
className: "flex justify-end gap-2",
|
|
5348
5349
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
@@ -6082,7 +6083,8 @@ function AutoCrudTable({ title, description, schema, resource, fields, table: ta
|
|
|
6082
6083
|
variant: resource.modal.variant,
|
|
6083
6084
|
overrides: formOverrides,
|
|
6084
6085
|
locale: locale.formModal,
|
|
6085
|
-
gridColumns: formConfig?.columns
|
|
6086
|
+
gridColumns: formConfig?.columns,
|
|
6087
|
+
className: formConfig?.className
|
|
6086
6088
|
}),
|
|
6087
6089
|
/* @__PURE__ */ jsx(ViewModal, {
|
|
6088
6090
|
open: resource.modal.viewOpen,
|
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.5",
|
|
5
5
|
"description": "Schema-first CRUD components with auto-generated tables and forms",
|
|
6
6
|
"author": "wordrhyme",
|
|
7
7
|
"license": "MIT",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"nanoid": "^5.1.6",
|
|
66
66
|
"tailwind-merge": "^3.4.0",
|
|
67
67
|
"vaul": "^1.1.2",
|
|
68
|
-
"@pixpilot/shadcn": "1.2
|
|
69
|
-
"@pixpilot/
|
|
70
|
-
"@pixpilot/shadcn-ui": "1.4.
|
|
68
|
+
"@pixpilot/formily-shadcn": "1.7.2",
|
|
69
|
+
"@pixpilot/shadcn": "1.2.0",
|
|
70
|
+
"@pixpilot/shadcn-ui": "1.4.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@tanstack/react-query": "^5.90.15",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"tsdown": "^0.15.12",
|
|
83
83
|
"typescript": "^5.9.3",
|
|
84
84
|
"@internal/eslint-config": "0.3.0",
|
|
85
|
+
"@internal/prettier-config": "0.0.1",
|
|
85
86
|
"@internal/tsconfig": "0.1.0",
|
|
86
87
|
"@internal/tsdown-config": "0.1.0",
|
|
87
|
-
"@internal/prettier-config": "0.0.1",
|
|
88
88
|
"@internal/vitest-config": "0.1.0"
|
|
89
89
|
},
|
|
90
90
|
"prettier": "@internal/prettier-config",
|