@wordrhyme/auto-crud 1.0.2 → 1.0.4
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 +6 -4
- package/dist/index.d.cts +18 -16
- package/dist/index.d.ts +18 -16
- package/dist/index.js +6 -4
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -4814,7 +4814,7 @@ function getComponentProps(type, parsed) {
|
|
|
4814
4814
|
function createFormSchema(schema, options) {
|
|
4815
4815
|
const shape = schema.shape;
|
|
4816
4816
|
const properties = {};
|
|
4817
|
-
const { overrides, exclude = [], layout = "vertical", gridColumns =
|
|
4817
|
+
const { overrides, exclude = [], layout = "vertical", gridColumns = 1, labelAlign = "top", labelWidth, labelCol, wrapperCol } = options ?? {};
|
|
4818
4818
|
const decoratorProps = { className: "space-y-2" };
|
|
4819
4819
|
if (labelAlign) decoratorProps.labelAlign = labelAlign;
|
|
4820
4820
|
if (labelWidth) decoratorProps.labelWidth = labelWidth;
|
|
@@ -4879,7 +4879,7 @@ const FormilySwitch = (0, __formily_react.connect)(__pixpilot_shadcn.Switch, (0,
|
|
|
4879
4879
|
value: "checked",
|
|
4880
4880
|
onInput: "onCheckedChange"
|
|
4881
4881
|
}));
|
|
4882
|
-
function AutoFormInner({ schema: zodSchema, initialValues, onSubmit, overrides, mode = "create", loading = false, gridColumns =
|
|
4882
|
+
function AutoFormInner({ schema: zodSchema, initialValues, onSubmit, overrides, mode = "create", loading = false, gridColumns = 1, labelAlign = "top", labelWidth, showSubmitButton = true }, ref) {
|
|
4883
4883
|
const form = (0, react.useMemo)(() => (0, __formily_core.createForm)({ initialValues }), [JSON.stringify(initialValues)]);
|
|
4884
4884
|
const formSchema = (0, react.useMemo)(() => createEditFormSchema(zodSchema, {
|
|
4885
4885
|
overrides,
|
|
@@ -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, labelAlign, labelWidth }) {
|
|
5377
|
+
function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubmit, loading = false, variant = "dialog", overrides, title, locale = zhCN.formModal, gridColumns, labelAlign, labelWidth }) {
|
|
5378
5378
|
const defaultTitle = mode === "create" ? locale.createTitle : locale.editTitle;
|
|
5379
5379
|
const formRef = (0, react.useRef)(null);
|
|
5380
5380
|
const handleSubmit = async () => {
|
|
@@ -5407,6 +5407,7 @@ function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubm
|
|
|
5407
5407
|
loading,
|
|
5408
5408
|
onSubmit,
|
|
5409
5409
|
overrides,
|
|
5410
|
+
gridColumns,
|
|
5410
5411
|
labelAlign,
|
|
5411
5412
|
labelWidth,
|
|
5412
5413
|
showSubmitButton: false
|
|
@@ -6122,7 +6123,8 @@ function AutoCrudTable({ title, description, schema, resource, fields, table: ta
|
|
|
6122
6123
|
loading: resource.mutations.isCreating || resource.mutations.isUpdating,
|
|
6123
6124
|
variant: resource.modal.variant,
|
|
6124
6125
|
overrides: formOverrides,
|
|
6125
|
-
locale: locale.formModal
|
|
6126
|
+
locale: locale.formModal,
|
|
6127
|
+
gridColumns: formConfig?.columns
|
|
6126
6128
|
}),
|
|
6127
6129
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ViewModal, {
|
|
6128
6130
|
open: resource.modal.viewOpen,
|
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
|
/**
|
|
@@ -766,7 +766,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
766
766
|
permissions,
|
|
767
767
|
actions: actionItems,
|
|
768
768
|
locale: localeProp
|
|
769
|
-
}: AutoCrudTableProps<TSchema>):
|
|
769
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime3.JSX.Element;
|
|
770
770
|
//#endregion
|
|
771
771
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
772
772
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -798,7 +798,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
798
798
|
labelAlign,
|
|
799
799
|
labelWidth,
|
|
800
800
|
showSubmitButton
|
|
801
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
801
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime3.JSX.Element;
|
|
802
802
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
803
803
|
ref?: React.Ref<AutoFormRef>;
|
|
804
804
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1096,7 +1096,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1096
1096
|
shallow,
|
|
1097
1097
|
filters: externalFilters,
|
|
1098
1098
|
onFiltersChange
|
|
1099
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1099
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime3.JSX.Element | null;
|
|
1100
1100
|
//#endregion
|
|
1101
1101
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1102
1102
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1114,6 +1114,7 @@ interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
1114
1114
|
overrides?: FormSchemaOverrides;
|
|
1115
1115
|
title?: string;
|
|
1116
1116
|
locale?: AutoCrudLocale["formModal"];
|
|
1117
|
+
gridColumns?: number;
|
|
1117
1118
|
/** Label 对齐方式 */
|
|
1118
1119
|
labelAlign?: "left" | "top" | "right";
|
|
1119
1120
|
/** Label 宽度(labelAlign 为 left 时有效) */
|
|
@@ -1131,9 +1132,10 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1131
1132
|
overrides,
|
|
1132
1133
|
title,
|
|
1133
1134
|
locale,
|
|
1135
|
+
gridColumns,
|
|
1134
1136
|
labelAlign,
|
|
1135
1137
|
labelWidth
|
|
1136
|
-
}: CrudFormModalProps<T>):
|
|
1138
|
+
}: CrudFormModalProps<T>): react_jsx_runtime3.JSX.Element;
|
|
1137
1139
|
//#endregion
|
|
1138
1140
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1139
1141
|
interface ImportDialogProps {
|
|
@@ -1155,7 +1157,7 @@ declare function ImportDialog({
|
|
|
1155
1157
|
columns,
|
|
1156
1158
|
title,
|
|
1157
1159
|
locale
|
|
1158
|
-
}: ImportDialogProps):
|
|
1160
|
+
}: ImportDialogProps): react_jsx_runtime3.JSX.Element;
|
|
1159
1161
|
//#endregion
|
|
1160
1162
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1161
1163
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1175,7 +1177,7 @@ declare function ExportDialog({
|
|
|
1175
1177
|
selectedCount,
|
|
1176
1178
|
onExport,
|
|
1177
1179
|
canExportFiltered
|
|
1178
|
-
}: ExportDialogProps):
|
|
1180
|
+
}: ExportDialogProps): react_jsx_runtime3.JSX.Element;
|
|
1179
1181
|
//#endregion
|
|
1180
1182
|
//#region src/components/data-table/data-table.d.ts
|
|
1181
1183
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1188,7 +1190,7 @@ declare function DataTable<TData>({
|
|
|
1188
1190
|
children,
|
|
1189
1191
|
className,
|
|
1190
1192
|
...props
|
|
1191
|
-
}: DataTableProps<TData>):
|
|
1193
|
+
}: DataTableProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1192
1194
|
//#endregion
|
|
1193
1195
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1194
1196
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1199,7 +1201,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1199
1201
|
children,
|
|
1200
1202
|
className,
|
|
1201
1203
|
...props
|
|
1202
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1204
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1203
1205
|
//#endregion
|
|
1204
1206
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1205
1207
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1211,7 +1213,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1211
1213
|
label,
|
|
1212
1214
|
className,
|
|
1213
1215
|
...props
|
|
1214
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1216
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
1215
1217
|
//#endregion
|
|
1216
1218
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1217
1219
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1225,7 +1227,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1225
1227
|
title,
|
|
1226
1228
|
options,
|
|
1227
1229
|
multiple
|
|
1228
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1230
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
1229
1231
|
//#endregion
|
|
1230
1232
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1231
1233
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1237,7 +1239,7 @@ declare function DataTablePagination<TData>({
|
|
|
1237
1239
|
pageSizeOptions,
|
|
1238
1240
|
className,
|
|
1239
1241
|
...props
|
|
1240
|
-
}: DataTablePaginationProps<TData>):
|
|
1242
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1241
1243
|
//#endregion
|
|
1242
1244
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1243
1245
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1248,7 +1250,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1248
1250
|
children,
|
|
1249
1251
|
className,
|
|
1250
1252
|
...props
|
|
1251
|
-
}: DataTableToolbarProps<TData>):
|
|
1253
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1252
1254
|
//#endregion
|
|
1253
1255
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1254
1256
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1259,7 +1261,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1259
1261
|
table,
|
|
1260
1262
|
disabled,
|
|
1261
1263
|
...props
|
|
1262
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1264
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1263
1265
|
//#endregion
|
|
1264
1266
|
//#region src/hooks/use-data-table.d.ts
|
|
1265
1267
|
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_runtime0 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_runtime0.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_runtime0.JSX.Element;
|
|
474
474
|
//#endregion
|
|
475
475
|
//#region src/i18n/locale.d.ts
|
|
476
476
|
/**
|
|
@@ -766,7 +766,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
766
766
|
permissions,
|
|
767
767
|
actions: actionItems,
|
|
768
768
|
locale: localeProp
|
|
769
|
-
}: AutoCrudTableProps<TSchema>):
|
|
769
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime0.JSX.Element;
|
|
770
770
|
//#endregion
|
|
771
771
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
772
772
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -798,7 +798,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
798
798
|
labelAlign,
|
|
799
799
|
labelWidth,
|
|
800
800
|
showSubmitButton
|
|
801
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
801
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime0.JSX.Element;
|
|
802
802
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
803
803
|
ref?: React.Ref<AutoFormRef>;
|
|
804
804
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1096,7 +1096,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1096
1096
|
shallow,
|
|
1097
1097
|
filters: externalFilters,
|
|
1098
1098
|
onFiltersChange
|
|
1099
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1099
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime0.JSX.Element | null;
|
|
1100
1100
|
//#endregion
|
|
1101
1101
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1102
1102
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1114,6 +1114,7 @@ interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
1114
1114
|
overrides?: FormSchemaOverrides;
|
|
1115
1115
|
title?: string;
|
|
1116
1116
|
locale?: AutoCrudLocale["formModal"];
|
|
1117
|
+
gridColumns?: number;
|
|
1117
1118
|
/** Label 对齐方式 */
|
|
1118
1119
|
labelAlign?: "left" | "top" | "right";
|
|
1119
1120
|
/** Label 宽度(labelAlign 为 left 时有效) */
|
|
@@ -1131,9 +1132,10 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1131
1132
|
overrides,
|
|
1132
1133
|
title,
|
|
1133
1134
|
locale,
|
|
1135
|
+
gridColumns,
|
|
1134
1136
|
labelAlign,
|
|
1135
1137
|
labelWidth
|
|
1136
|
-
}: CrudFormModalProps<T>):
|
|
1138
|
+
}: CrudFormModalProps<T>): react_jsx_runtime0.JSX.Element;
|
|
1137
1139
|
//#endregion
|
|
1138
1140
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1139
1141
|
interface ImportDialogProps {
|
|
@@ -1155,7 +1157,7 @@ declare function ImportDialog({
|
|
|
1155
1157
|
columns,
|
|
1156
1158
|
title,
|
|
1157
1159
|
locale
|
|
1158
|
-
}: ImportDialogProps):
|
|
1160
|
+
}: ImportDialogProps): react_jsx_runtime0.JSX.Element;
|
|
1159
1161
|
//#endregion
|
|
1160
1162
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1161
1163
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1175,7 +1177,7 @@ declare function ExportDialog({
|
|
|
1175
1177
|
selectedCount,
|
|
1176
1178
|
onExport,
|
|
1177
1179
|
canExportFiltered
|
|
1178
|
-
}: ExportDialogProps):
|
|
1180
|
+
}: ExportDialogProps): react_jsx_runtime0.JSX.Element;
|
|
1179
1181
|
//#endregion
|
|
1180
1182
|
//#region src/components/data-table/data-table.d.ts
|
|
1181
1183
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1188,7 +1190,7 @@ declare function DataTable<TData>({
|
|
|
1188
1190
|
children,
|
|
1189
1191
|
className,
|
|
1190
1192
|
...props
|
|
1191
|
-
}: DataTableProps<TData>):
|
|
1193
|
+
}: DataTableProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1192
1194
|
//#endregion
|
|
1193
1195
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1194
1196
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1199,7 +1201,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1199
1201
|
children,
|
|
1200
1202
|
className,
|
|
1201
1203
|
...props
|
|
1202
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1204
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1203
1205
|
//#endregion
|
|
1204
1206
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1205
1207
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1211,7 +1213,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1211
1213
|
label,
|
|
1212
1214
|
className,
|
|
1213
1215
|
...props
|
|
1214
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1216
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
|
|
1215
1217
|
//#endregion
|
|
1216
1218
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1217
1219
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1225,7 +1227,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1225
1227
|
title,
|
|
1226
1228
|
options,
|
|
1227
1229
|
multiple
|
|
1228
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1230
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
|
|
1229
1231
|
//#endregion
|
|
1230
1232
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1231
1233
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1237,7 +1239,7 @@ declare function DataTablePagination<TData>({
|
|
|
1237
1239
|
pageSizeOptions,
|
|
1238
1240
|
className,
|
|
1239
1241
|
...props
|
|
1240
|
-
}: DataTablePaginationProps<TData>):
|
|
1242
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1241
1243
|
//#endregion
|
|
1242
1244
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1243
1245
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1248,7 +1250,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1248
1250
|
children,
|
|
1249
1251
|
className,
|
|
1250
1252
|
...props
|
|
1251
|
-
}: DataTableToolbarProps<TData>):
|
|
1253
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1252
1254
|
//#endregion
|
|
1253
1255
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1254
1256
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1259,7 +1261,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1259
1261
|
table,
|
|
1260
1262
|
disabled,
|
|
1261
1263
|
...props
|
|
1262
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1264
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1263
1265
|
//#endregion
|
|
1264
1266
|
//#region src/hooks/use-data-table.d.ts
|
|
1265
1267
|
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
package/dist/index.js
CHANGED
|
@@ -4772,7 +4772,7 @@ function getComponentProps(type, parsed) {
|
|
|
4772
4772
|
function createFormSchema(schema, options) {
|
|
4773
4773
|
const shape = schema.shape;
|
|
4774
4774
|
const properties = {};
|
|
4775
|
-
const { overrides, exclude = [], layout = "vertical", gridColumns =
|
|
4775
|
+
const { overrides, exclude = [], layout = "vertical", gridColumns = 1, labelAlign = "top", labelWidth, labelCol, wrapperCol } = options ?? {};
|
|
4776
4776
|
const decoratorProps = { className: "space-y-2" };
|
|
4777
4777
|
if (labelAlign) decoratorProps.labelAlign = labelAlign;
|
|
4778
4778
|
if (labelWidth) decoratorProps.labelWidth = labelWidth;
|
|
@@ -4837,7 +4837,7 @@ const FormilySwitch = connect(Switch, mapProps({
|
|
|
4837
4837
|
value: "checked",
|
|
4838
4838
|
onInput: "onCheckedChange"
|
|
4839
4839
|
}));
|
|
4840
|
-
function AutoFormInner({ schema: zodSchema, initialValues, onSubmit, overrides, mode = "create", loading = false, gridColumns =
|
|
4840
|
+
function AutoFormInner({ schema: zodSchema, initialValues, onSubmit, overrides, mode = "create", loading = false, gridColumns = 1, labelAlign = "top", labelWidth, showSubmitButton = true }, ref) {
|
|
4841
4841
|
const form = useMemo(() => createForm({ initialValues }), [JSON.stringify(initialValues)]);
|
|
4842
4842
|
const formSchema = useMemo(() => createEditFormSchema(zodSchema, {
|
|
4843
4843
|
overrides,
|
|
@@ -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, labelAlign, labelWidth }) {
|
|
5335
|
+
function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubmit, loading = false, variant = "dialog", overrides, title, locale = zhCN.formModal, gridColumns, labelAlign, labelWidth }) {
|
|
5336
5336
|
const defaultTitle = mode === "create" ? locale.createTitle : locale.editTitle;
|
|
5337
5337
|
const formRef = useRef(null);
|
|
5338
5338
|
const handleSubmit = async () => {
|
|
@@ -5365,6 +5365,7 @@ function CrudFormModal({ open, onOpenChange, mode, schema, initialValues, onSubm
|
|
|
5365
5365
|
loading,
|
|
5366
5366
|
onSubmit,
|
|
5367
5367
|
overrides,
|
|
5368
|
+
gridColumns,
|
|
5368
5369
|
labelAlign,
|
|
5369
5370
|
labelWidth,
|
|
5370
5371
|
showSubmitButton: false
|
|
@@ -6080,7 +6081,8 @@ function AutoCrudTable({ title, description, schema, resource, fields, table: ta
|
|
|
6080
6081
|
loading: resource.mutations.isCreating || resource.mutations.isUpdating,
|
|
6081
6082
|
variant: resource.modal.variant,
|
|
6082
6083
|
overrides: formOverrides,
|
|
6083
|
-
locale: locale.formModal
|
|
6084
|
+
locale: locale.formModal,
|
|
6085
|
+
gridColumns: formConfig?.columns
|
|
6084
6086
|
}),
|
|
6085
6087
|
/* @__PURE__ */ jsx(ViewModal, {
|
|
6086
6088
|
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.4",
|
|
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/
|
|
69
|
-
"@pixpilot/shadcn
|
|
70
|
-
"@pixpilot/shadcn": "
|
|
68
|
+
"@pixpilot/shadcn-ui": "1.4.0",
|
|
69
|
+
"@pixpilot/formily-shadcn": "1.7.2",
|
|
70
|
+
"@pixpilot/shadcn": "1.2.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@tanstack/react-query": "^5.90.15",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"react-dom": "19.2.4",
|
|
82
82
|
"tsdown": "^0.15.12",
|
|
83
83
|
"typescript": "^5.9.3",
|
|
84
|
-
"@internal/eslint-config": "0.3.0",
|
|
85
84
|
"@internal/prettier-config": "0.0.1",
|
|
85
|
+
"@internal/eslint-config": "0.3.0",
|
|
86
86
|
"@internal/tsconfig": "0.1.0",
|
|
87
87
|
"@internal/tsdown-config": "0.1.0",
|
|
88
88
|
"@internal/vitest-config": "0.1.0"
|