@wordrhyme/auto-crud 1.14.0 → 1.14.1
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 +7 -0
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +17 -17
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1782,6 +1782,13 @@ 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
|
+
|
|
1785
1792
|
```tsx
|
|
1786
1793
|
<AutoCrudTable
|
|
1787
1794
|
schema={schema}
|
package/dist/index.cjs
CHANGED
|
@@ -7821,12 +7821,13 @@ function ViewModalContent({ open, onOpenChange, variant, data, schema, fields: f
|
|
|
7821
7821
|
const detailSchema = react.useMemo(() => schema.omit(Object.fromEntries(excluded.map((key) => [key, true]))), [schema, excluded]);
|
|
7822
7822
|
const overrides = buildFormOverrides(fieldConfig, form?.overrides, denyFields, "view");
|
|
7823
7823
|
const renderers = {};
|
|
7824
|
-
for (const
|
|
7824
|
+
for (const cell of table.getRowModel().rows[0]?.getAllCells() ?? []) {
|
|
7825
7825
|
const key = cell.column.id;
|
|
7826
|
+
const index$1 = view?.overrides?.[key]?.index;
|
|
7826
7827
|
overrides[key] = {
|
|
7827
7828
|
...overrides[key],
|
|
7828
7829
|
title: cell.column.columnDef.meta?.label ?? humanize(key),
|
|
7829
|
-
"x-index": index$1
|
|
7830
|
+
...index$1 !== void 0 ? { "x-index": index$1 } : {}
|
|
7830
7831
|
};
|
|
7831
7832
|
renderers[key] = () => (0, __tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
7832
7833
|
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_runtime9 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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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_runtime9.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
|
@@ -7805,12 +7805,13 @@ function ViewModalContent({ open, onOpenChange, variant, data, schema, fields: f
|
|
|
7805
7805
|
const detailSchema = React.useMemo(() => schema.omit(Object.fromEntries(excluded.map((key) => [key, true]))), [schema, excluded]);
|
|
7806
7806
|
const overrides = buildFormOverrides(fieldConfig, form?.overrides, denyFields, "view");
|
|
7807
7807
|
const renderers = {};
|
|
7808
|
-
for (const
|
|
7808
|
+
for (const cell of table.getRowModel().rows[0]?.getAllCells() ?? []) {
|
|
7809
7809
|
const key = cell.column.id;
|
|
7810
|
+
const index$1 = view?.overrides?.[key]?.index;
|
|
7810
7811
|
overrides[key] = {
|
|
7811
7812
|
...overrides[key],
|
|
7812
7813
|
title: cell.column.columnDef.meta?.label ?? humanize(key),
|
|
7813
|
-
"x-index": index$1
|
|
7814
|
+
...index$1 !== void 0 ? { "x-index": index$1 } : {}
|
|
7814
7815
|
};
|
|
7815
7816
|
renderers[key] = () => flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
7816
7817
|
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.1",
|
|
5
5
|
"description": "Schema-first CRUD components with auto-generated tables and forms",
|
|
6
6
|
"author": "wordrhyme",
|
|
7
7
|
"license": "MIT",
|
|
@@ -95,8 +95,8 @@
|
|
|
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",
|
|
99
|
+
"@internal/prettier-config": "0.0.1",
|
|
100
100
|
"@internal/tsdown-config": "0.1.0",
|
|
101
101
|
"@internal/vitest-config": "0.1.0"
|
|
102
102
|
},
|