@wordrhyme/auto-crud 1.14.0 → 1.14.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/README.md +9 -0
- package/dist/index.cjs +7 -11
- package/dist/index.d.cts +17 -17
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1782,6 +1782,15 @@ Table-only hidden fields remain available in details; shared `hidden` and
|
|
|
1782
1782
|
`permissions.deny` always take precedence. Labels are resolved from the selected
|
|
1783
1783
|
record, including when it is absent from the current list page.
|
|
1784
1784
|
|
|
1785
|
+
Details share the form's column count, field spans and `x-index` order (including
|
|
1786
|
+
`form.overrides`). Fields without an index retain schema order. List column order
|
|
1787
|
+
does not control detail layout, even with `view.presentation: 'table'`.
|
|
1788
|
+
`view.overrides[field].index` takes precedence for detail-only ordering. Fields
|
|
1789
|
+
hidden only in forms remain available in details; use detail ordering to place
|
|
1790
|
+
read-only business fields next to related information or audit fields at the end.
|
|
1791
|
+
Field spans come from the shared form configuration; details do not expand arrays,
|
|
1792
|
+
objects or long-text fields to a full row automatically.
|
|
1793
|
+
|
|
1785
1794
|
```tsx
|
|
1786
1795
|
<AutoCrudTable
|
|
1787
1796
|
schema={schema}
|
package/dist/index.cjs
CHANGED
|
@@ -6268,15 +6268,10 @@ function AutoFormInner({ schema: zodSchema, initialValues, onSubmit, fields, ove
|
|
|
6268
6268
|
className: (0, __wordrhyme_shadcn.cn)(grid["x-component-props"]?.className, "gap-x-10 gap-y-7 py-2")
|
|
6269
6269
|
};
|
|
6270
6270
|
const properties = typeof grid.properties === "object" ? grid.properties : {};
|
|
6271
|
-
for (const property of Object.values(properties)) {
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
colon: false,
|
|
6276
|
-
...decoratorProps,
|
|
6277
|
-
className: (0, __wordrhyme_shadcn.cn)(fullWidth && decoratorProps?.gridSpan == null && "col-span-full", decoratorProps?.className)
|
|
6278
|
-
};
|
|
6279
|
-
}
|
|
6271
|
+
for (const property of Object.values(properties)) property["x-decorator-props"] = {
|
|
6272
|
+
colon: false,
|
|
6273
|
+
...property["x-decorator-props"]
|
|
6274
|
+
};
|
|
6280
6275
|
}
|
|
6281
6276
|
applyDataSourceReactions(nextSchema, mode === "view");
|
|
6282
6277
|
return nextSchema;
|
|
@@ -7821,12 +7816,13 @@ function ViewModalContent({ open, onOpenChange, variant, data, schema, fields: f
|
|
|
7821
7816
|
const detailSchema = react.useMemo(() => schema.omit(Object.fromEntries(excluded.map((key) => [key, true]))), [schema, excluded]);
|
|
7822
7817
|
const overrides = buildFormOverrides(fieldConfig, form?.overrides, denyFields, "view");
|
|
7823
7818
|
const renderers = {};
|
|
7824
|
-
for (const
|
|
7819
|
+
for (const cell of table.getRowModel().rows[0]?.getAllCells() ?? []) {
|
|
7825
7820
|
const key = cell.column.id;
|
|
7821
|
+
const index$1 = view?.overrides?.[key]?.index;
|
|
7826
7822
|
overrides[key] = {
|
|
7827
7823
|
...overrides[key],
|
|
7828
7824
|
title: cell.column.columnDef.meta?.label ?? humanize(key),
|
|
7829
|
-
"x-index": index$1
|
|
7825
|
+
...index$1 !== void 0 ? { "x-index": index$1 } : {}
|
|
7830
7826
|
};
|
|
7831
7827
|
renderers[key] = () => (0, __tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
7832
7828
|
delete overrides[key]["x-data-source"];
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as positionActions, i as matchesPosition, n as actionPositionSchema, r as compareOrder, t as ActionPosition } from "./position-DoBV7yB6.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
import { ComponentProps, ReactNode } from "react";
|
|
5
5
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
@@ -676,7 +676,7 @@ declare function DataTable<TData>({
|
|
|
676
676
|
className,
|
|
677
677
|
classNames,
|
|
678
678
|
...props
|
|
679
|
-
}: DataTableProps<TData>):
|
|
679
|
+
}: DataTableProps<TData>): react_jsx_runtime8.JSX.Element;
|
|
680
680
|
//#endregion
|
|
681
681
|
//#region src/components/auto-crud/auto-table-action-bar.d.ts
|
|
682
682
|
/** 批量更新字段配置 */
|
|
@@ -765,7 +765,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
765
765
|
extraActions,
|
|
766
766
|
actions,
|
|
767
767
|
deleteConfirmation
|
|
768
|
-
}: AutoTableActionBarProps<TData>):
|
|
768
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime8.JSX.Element;
|
|
769
769
|
//#endregion
|
|
770
770
|
//#region src/lib/schema-bridge/types.d.ts
|
|
771
771
|
/**
|
|
@@ -1109,7 +1109,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1109
1109
|
onSelectedRowsChange,
|
|
1110
1110
|
getSelectedRows,
|
|
1111
1111
|
exportTableRef
|
|
1112
|
-
}: AutoTableProps<T>):
|
|
1112
|
+
}: AutoTableProps<T>): react_jsx_runtime8.JSX.Element;
|
|
1113
1113
|
//#endregion
|
|
1114
1114
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
1115
1115
|
type AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> = {
|
|
@@ -1152,7 +1152,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1152
1152
|
labelAlign,
|
|
1153
1153
|
labelWidth,
|
|
1154
1154
|
showSubmitButton
|
|
1155
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1155
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime8.JSX.Element;
|
|
1156
1156
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1157
1157
|
ref?: React.Ref<AutoFormRef>;
|
|
1158
1158
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1491,7 +1491,7 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
1491
1491
|
* 支持共用配置(label, hidden)+ 表格/表单特定配置
|
|
1492
1492
|
*/
|
|
1493
1493
|
fields?: Fields;
|
|
1494
|
-
/**
|
|
1494
|
+
/** Details share form layout and field formatting by default. */
|
|
1495
1495
|
view?: {
|
|
1496
1496
|
/** Explicitly reuse custom list cells with a separate, single-row table context. */
|
|
1497
1497
|
presentation?: 'table';
|
|
@@ -1622,7 +1622,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1622
1622
|
locale: localeProp,
|
|
1623
1623
|
onCreate,
|
|
1624
1624
|
onExport
|
|
1625
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1625
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime8.JSX.Element;
|
|
1626
1626
|
//#endregion
|
|
1627
1627
|
//#region src/components/auto-crud/auto-table-simple-filters.d.ts
|
|
1628
1628
|
interface AutoTableSimpleFiltersProps<TData> {
|
|
@@ -1638,7 +1638,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1638
1638
|
filters: externalFilters,
|
|
1639
1639
|
onFiltersChange,
|
|
1640
1640
|
leading
|
|
1641
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1641
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime8.JSX.Element | null;
|
|
1642
1642
|
//#endregion
|
|
1643
1643
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1644
1644
|
type ModalVariant = 'dialog' | 'sheet';
|
|
@@ -1687,7 +1687,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1687
1687
|
labelAlign,
|
|
1688
1688
|
labelWidth,
|
|
1689
1689
|
className
|
|
1690
|
-
}: CrudFormModalProps<T> & CrudFormModalMode<T>):
|
|
1690
|
+
}: CrudFormModalProps<T> & CrudFormModalMode<T>): react_jsx_runtime8.JSX.Element;
|
|
1691
1691
|
//#endregion
|
|
1692
1692
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1693
1693
|
interface ImportDialogProps {
|
|
@@ -1709,7 +1709,7 @@ declare function ImportDialog({
|
|
|
1709
1709
|
columns,
|
|
1710
1710
|
title,
|
|
1711
1711
|
locale
|
|
1712
|
-
}: ImportDialogProps):
|
|
1712
|
+
}: ImportDialogProps): react_jsx_runtime8.JSX.Element;
|
|
1713
1713
|
//#endregion
|
|
1714
1714
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1715
1715
|
type ExportMode = 'selected' | 'filtered';
|
|
@@ -1729,7 +1729,7 @@ declare function ExportDialog({
|
|
|
1729
1729
|
selectedCount,
|
|
1730
1730
|
onExport,
|
|
1731
1731
|
canExportFiltered
|
|
1732
|
-
}: ExportDialogProps):
|
|
1732
|
+
}: ExportDialogProps): react_jsx_runtime8.JSX.Element;
|
|
1733
1733
|
//#endregion
|
|
1734
1734
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1735
1735
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1740,7 +1740,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1740
1740
|
children,
|
|
1741
1741
|
className,
|
|
1742
1742
|
...props
|
|
1743
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1743
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime8.JSX.Element;
|
|
1744
1744
|
//#endregion
|
|
1745
1745
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1746
1746
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1752,7 +1752,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1752
1752
|
label,
|
|
1753
1753
|
className,
|
|
1754
1754
|
...props
|
|
1755
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1755
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime8.JSX.Element;
|
|
1756
1756
|
//#endregion
|
|
1757
1757
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1758
1758
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1766,7 +1766,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1766
1766
|
title,
|
|
1767
1767
|
options,
|
|
1768
1768
|
multiple
|
|
1769
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1769
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime8.JSX.Element;
|
|
1770
1770
|
//#endregion
|
|
1771
1771
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1772
1772
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<'div'>, TablePaginationOptions {
|
|
@@ -1782,7 +1782,7 @@ declare function DataTablePagination<TData>({
|
|
|
1782
1782
|
pageJumpLabel,
|
|
1783
1783
|
className,
|
|
1784
1784
|
...props
|
|
1785
|
-
}: DataTablePaginationProps<TData>):
|
|
1785
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime8.JSX.Element;
|
|
1786
1786
|
//#endregion
|
|
1787
1787
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1788
1788
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1793,7 +1793,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1793
1793
|
children,
|
|
1794
1794
|
className,
|
|
1795
1795
|
...props
|
|
1796
|
-
}: DataTableToolbarProps<TData>):
|
|
1796
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime8.JSX.Element;
|
|
1797
1797
|
//#endregion
|
|
1798
1798
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1799
1799
|
interface DataTableViewOptionsProps<TData> extends PopoverContentProps {
|
|
@@ -1806,7 +1806,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1806
1806
|
disabled,
|
|
1807
1807
|
locale,
|
|
1808
1808
|
...props
|
|
1809
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1809
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime8.JSX.Element;
|
|
1810
1810
|
//#endregion
|
|
1811
1811
|
//#region src/lib/crud-actions.d.ts
|
|
1812
1812
|
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
package/dist/index.d.ts
CHANGED
|
@@ -1491,7 +1491,7 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
1491
1491
|
* 支持共用配置(label, hidden)+ 表格/表单特定配置
|
|
1492
1492
|
*/
|
|
1493
1493
|
fields?: Fields;
|
|
1494
|
-
/**
|
|
1494
|
+
/** Details share form layout and field formatting by default. */
|
|
1495
1495
|
view?: {
|
|
1496
1496
|
/** Explicitly reuse custom list cells with a separate, single-row table context. */
|
|
1497
1497
|
presentation?: 'table';
|
package/dist/index.js
CHANGED
|
@@ -6252,15 +6252,10 @@ function AutoFormInner({ schema: zodSchema, initialValues, onSubmit, fields, ove
|
|
|
6252
6252
|
className: cn$1(grid["x-component-props"]?.className, "gap-x-10 gap-y-7 py-2")
|
|
6253
6253
|
};
|
|
6254
6254
|
const properties = typeof grid.properties === "object" ? grid.properties : {};
|
|
6255
|
-
for (const property of Object.values(properties)) {
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
colon: false,
|
|
6260
|
-
...decoratorProps,
|
|
6261
|
-
className: cn$1(fullWidth && decoratorProps?.gridSpan == null && "col-span-full", decoratorProps?.className)
|
|
6262
|
-
};
|
|
6263
|
-
}
|
|
6255
|
+
for (const property of Object.values(properties)) property["x-decorator-props"] = {
|
|
6256
|
+
colon: false,
|
|
6257
|
+
...property["x-decorator-props"]
|
|
6258
|
+
};
|
|
6264
6259
|
}
|
|
6265
6260
|
applyDataSourceReactions(nextSchema, mode === "view");
|
|
6266
6261
|
return nextSchema;
|
|
@@ -7805,12 +7800,13 @@ function ViewModalContent({ open, onOpenChange, variant, data, schema, fields: f
|
|
|
7805
7800
|
const detailSchema = React.useMemo(() => schema.omit(Object.fromEntries(excluded.map((key) => [key, true]))), [schema, excluded]);
|
|
7806
7801
|
const overrides = buildFormOverrides(fieldConfig, form?.overrides, denyFields, "view");
|
|
7807
7802
|
const renderers = {};
|
|
7808
|
-
for (const
|
|
7803
|
+
for (const cell of table.getRowModel().rows[0]?.getAllCells() ?? []) {
|
|
7809
7804
|
const key = cell.column.id;
|
|
7805
|
+
const index$1 = view?.overrides?.[key]?.index;
|
|
7810
7806
|
overrides[key] = {
|
|
7811
7807
|
...overrides[key],
|
|
7812
7808
|
title: cell.column.columnDef.meta?.label ?? humanize(key),
|
|
7813
|
-
"x-index": index$1
|
|
7809
|
+
...index$1 !== void 0 ? { "x-index": index$1 } : {}
|
|
7814
7810
|
};
|
|
7815
7811
|
renderers[key] = () => flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
7816
7812
|
delete overrides[key]["x-data-source"];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordrhyme/auto-crud",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.2",
|
|
5
5
|
"description": "Schema-first CRUD components with auto-generated tables and forms",
|
|
6
6
|
"author": "wordrhyme",
|
|
7
7
|
"license": "MIT",
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
"typescript": "^5.9.3",
|
|
96
96
|
"vitest": "^3.2.4",
|
|
97
97
|
"@internal/eslint-config": "0.3.0",
|
|
98
|
-
"@internal/prettier-config": "0.0.1",
|
|
99
98
|
"@internal/tsconfig": "0.1.0",
|
|
100
99
|
"@internal/tsdown-config": "0.1.0",
|
|
101
|
-
"@internal/vitest-config": "0.1.0"
|
|
100
|
+
"@internal/vitest-config": "0.1.0",
|
|
101
|
+
"@internal/prettier-config": "0.0.1"
|
|
102
102
|
},
|
|
103
103
|
"prettier": "@internal/prettier-config",
|
|
104
104
|
"scripts": {
|