@wordrhyme/auto-crud 1.1.5 → 1.1.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 CHANGED
@@ -1459,6 +1459,7 @@ function DataTableFilterList({ table, debounceMs = DEBOUNCE_MS$2, throttleMs = T
1459
1459
  const descriptionId = react.useId();
1460
1460
  const [open, setOpen] = react.useState(false);
1461
1461
  const addButtonRef = react.useRef(null);
1462
+ const columnDefs = table.options.columns;
1462
1463
  const columns = react.useMemo(() => {
1463
1464
  return table.getAllColumns().filter((column) => {
1464
1465
  if (!column.getCanFilter()) return false;
@@ -1466,7 +1467,7 @@ function DataTableFilterList({ table, debounceMs = DEBOUNCE_MS$2, throttleMs = T
1466
1467
  if (modes && !modes.includes("advanced")) return false;
1467
1468
  return true;
1468
1469
  });
1469
- }, [table]);
1470
+ }, [table, columnDefs]);
1470
1471
  const [filters, setFilters] = useReadableFilters(columns, { debounceMs });
1471
1472
  const debouncedSetFilters = useDebouncedCallback(setFilters, debounceMs);
1472
1473
  const [joinOperator, setJoinOperator] = useQueryState(table.options.meta?.queryKeys?.joinOperator ?? "", parseAsStringEnum(["and", "or"]).withDefault("and"));
@@ -1953,6 +1954,7 @@ function getOptionCommandValue$2(option) {
1953
1954
  }
1954
1955
  function DataTableFilterMenu({ table, debounceMs = DEBOUNCE_MS$1, throttleMs = THROTTLE_MS$1, shallow = true, disabled,...props }) {
1955
1956
  const id = react.useId();
1957
+ const columnDefs = table.options.columns;
1956
1958
  const columns = react.useMemo(() => {
1957
1959
  return table.getAllColumns().filter((column) => {
1958
1960
  if (!column.columnDef.enableColumnFilter) return false;
@@ -1960,7 +1962,7 @@ function DataTableFilterMenu({ table, debounceMs = DEBOUNCE_MS$1, throttleMs = T
1960
1962
  if (modes && !modes.includes("command")) return false;
1961
1963
  return true;
1962
1964
  });
1963
- }, [table]);
1965
+ }, [table, columnDefs]);
1964
1966
  const [open, setOpen] = react.useState(false);
1965
1967
  const [selectedColumn, setSelectedColumn] = react.useState(null);
1966
1968
  const [inputValue, setInputValue] = react.useState("");
@@ -2716,6 +2718,7 @@ function DataTableViewOptions({ table, disabled,...props }) {
2716
2718
  //#endregion
2717
2719
  //#region src/components/auto-crud/auto-table-simple-filters.tsx
2718
2720
  function AutoTableSimpleFilters({ table, shallow = false, filters: externalFilters, onFiltersChange, leading }) {
2721
+ const columnDefs = table.options.columns;
2719
2722
  const columns = react.useMemo(() => table.getAllColumns().filter((col) => col.getCanFilter()).sort((a, b) => {
2720
2723
  const readOrder = (column) => {
2721
2724
  const metaIndex = column.columnDef.meta?.index;
@@ -2725,7 +2728,7 @@ function AutoTableSimpleFilters({ table, shallow = false, filters: externalFilte
2725
2728
  const orderDiff = readOrder(a) - readOrder(b);
2726
2729
  if (orderDiff !== 0) return orderDiff;
2727
2730
  return a.getIndex() - b.getIndex();
2728
- }), [table]);
2731
+ }), [table, columnDefs]);
2729
2732
  const queryStateOptions = table.options.meta?.queryStateOptions;
2730
2733
  const [queryFilters, setQueryFilters] = useReadableFilters(columns, {
2731
2734
  ...queryStateOptions,
@@ -4757,25 +4760,27 @@ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection
4757
4760
  clearOnDefault: true
4758
4761
  });
4759
4762
  const searchConfig = search && typeof search === "object" ? search : {};
4763
+ const enableAdvancedFilter = true;
4764
+ const columns = (0, react.useMemo)(() => {
4765
+ const dataColumns = createTableSchema(schema, {
4766
+ overrides,
4767
+ exclude
4768
+ });
4769
+ const result = enableRowSelection ? [createSelectColumn(), ...dataColumns] : dataColumns;
4770
+ if (actions) result.push(createActionsColumn(actions));
4771
+ return result;
4772
+ }, [
4773
+ schema,
4774
+ overrides,
4775
+ enableRowSelection,
4776
+ exclude,
4777
+ actions
4778
+ ]);
4760
4779
  const { table, shallow, debounceMs, throttleMs } = useDataTable({
4761
4780
  data,
4762
- columns: (0, react.useMemo)(() => {
4763
- const dataColumns = createTableSchema(schema, {
4764
- overrides,
4765
- exclude
4766
- });
4767
- const result = enableRowSelection ? [createSelectColumn(), ...dataColumns] : dataColumns;
4768
- if (actions) result.push(createActionsColumn(actions));
4769
- return result;
4770
- }, [
4771
- schema,
4772
- overrides,
4773
- enableRowSelection,
4774
- exclude,
4775
- actions
4776
- ]),
4781
+ columns,
4777
4782
  pageCount,
4778
- enableAdvancedFilter: true,
4783
+ enableAdvancedFilter,
4779
4784
  initialState: (0, react.useMemo)(() => ({
4780
4785
  sorting: initialSorting,
4781
4786
  columnPinning: pinnedColumns ?? {
@@ -4861,6 +4866,7 @@ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection
4861
4866
  }, [
4862
4867
  currentMode,
4863
4868
  table,
4869
+ columns,
4864
4870
  shallow,
4865
4871
  searchInput,
4866
4872
  debounceMs,
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 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";
@@ -361,7 +361,7 @@ declare function AutoTableActionBar<TData>({
361
361
  enableDelete,
362
362
  extraActions,
363
363
  actions
364
- }: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
364
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime7.JSX.Element;
365
365
  //#endregion
366
366
  //#region src/lib/schema-bridge/types.d.ts
367
367
  /**
@@ -529,7 +529,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
529
529
  showDefaultExport,
530
530
  onSelectedCountChange,
531
531
  getSelectedRows
532
- }: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
532
+ }: AutoTableProps<T>): react_jsx_runtime7.JSX.Element;
533
533
  //#endregion
534
534
  //#region src/i18n/locale.d.ts
535
535
  /**
@@ -875,7 +875,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
875
875
  toolbarActions,
876
876
  locale: localeProp,
877
877
  onCreate
878
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
878
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime7.JSX.Element;
879
879
  //#endregion
880
880
  //#region src/components/auto-crud/auto-form.d.ts
881
881
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -907,7 +907,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
907
907
  labelAlign,
908
908
  labelWidth,
909
909
  showSubmitButton
910
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
910
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime7.JSX.Element;
911
911
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
912
912
  ref?: React.Ref<AutoFormRef>;
913
913
  }) => ReturnType<typeof AutoFormInner>;
@@ -1209,7 +1209,7 @@ declare function AutoTableSimpleFilters<TData>({
1209
1209
  filters: externalFilters,
1210
1210
  onFiltersChange,
1211
1211
  leading
1212
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime2.JSX.Element | null;
1212
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime7.JSX.Element | null;
1213
1213
  //#endregion
1214
1214
  //#region src/components/auto-crud/form-modal.d.ts
1215
1215
  type ModalVariant = "dialog" | "sheet";
@@ -1251,7 +1251,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1251
1251
  labelAlign,
1252
1252
  labelWidth,
1253
1253
  className
1254
- }: CrudFormModalProps<T>): react_jsx_runtime2.JSX.Element;
1254
+ }: CrudFormModalProps<T>): react_jsx_runtime7.JSX.Element;
1255
1255
  //#endregion
1256
1256
  //#region src/components/auto-crud/import-dialog.d.ts
1257
1257
  interface ImportDialogProps {
@@ -1273,7 +1273,7 @@ declare function ImportDialog({
1273
1273
  columns,
1274
1274
  title,
1275
1275
  locale
1276
- }: ImportDialogProps): react_jsx_runtime2.JSX.Element;
1276
+ }: ImportDialogProps): react_jsx_runtime7.JSX.Element;
1277
1277
  //#endregion
1278
1278
  //#region src/components/auto-crud/export-dialog.d.ts
1279
1279
  type ExportMode = "selected" | "filtered";
@@ -1293,7 +1293,7 @@ declare function ExportDialog({
1293
1293
  selectedCount,
1294
1294
  onExport,
1295
1295
  canExportFiltered
1296
- }: ExportDialogProps): react_jsx_runtime2.JSX.Element;
1296
+ }: ExportDialogProps): react_jsx_runtime7.JSX.Element;
1297
1297
  //#endregion
1298
1298
  //#region src/components/data-table/data-table.d.ts
1299
1299
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1306,7 +1306,7 @@ declare function DataTable<TData>({
1306
1306
  children,
1307
1307
  className,
1308
1308
  ...props
1309
- }: DataTableProps<TData>): react_jsx_runtime2.JSX.Element;
1309
+ }: DataTableProps<TData>): react_jsx_runtime7.JSX.Element;
1310
1310
  //#endregion
1311
1311
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1312
1312
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1317,7 +1317,7 @@ declare function DataTableAdvancedToolbar<TData>({
1317
1317
  children,
1318
1318
  className,
1319
1319
  ...props
1320
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1320
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime7.JSX.Element;
1321
1321
  //#endregion
1322
1322
  //#region src/components/data-table/data-table-column-header.d.ts
1323
1323
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1329,7 +1329,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1329
1329
  label,
1330
1330
  className,
1331
1331
  ...props
1332
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1332
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime7.JSX.Element;
1333
1333
  //#endregion
1334
1334
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1335
1335
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1343,7 +1343,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1343
1343
  title,
1344
1344
  options,
1345
1345
  multiple
1346
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1346
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime7.JSX.Element;
1347
1347
  //#endregion
1348
1348
  //#region src/components/data-table/data-table-pagination.d.ts
1349
1349
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1355,7 +1355,7 @@ declare function DataTablePagination<TData>({
1355
1355
  pageSizeOptions,
1356
1356
  className,
1357
1357
  ...props
1358
- }: DataTablePaginationProps<TData>): react_jsx_runtime2.JSX.Element;
1358
+ }: DataTablePaginationProps<TData>): react_jsx_runtime7.JSX.Element;
1359
1359
  //#endregion
1360
1360
  //#region src/components/data-table/data-table-toolbar.d.ts
1361
1361
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1366,7 +1366,7 @@ declare function DataTableToolbar<TData>({
1366
1366
  children,
1367
1367
  className,
1368
1368
  ...props
1369
- }: DataTableToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1369
+ }: DataTableToolbarProps<TData>): react_jsx_runtime7.JSX.Element;
1370
1370
  //#endregion
1371
1371
  //#region src/components/data-table/data-table-view-options.d.ts
1372
1372
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1377,7 +1377,7 @@ declare function DataTableViewOptions<TData>({
1377
1377
  table,
1378
1378
  disabled,
1379
1379
  ...props
1380
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime2.JSX.Element;
1380
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime7.JSX.Element;
1381
1381
  //#endregion
1382
1382
  //#region src/hooks/use-data-table.d.ts
1383
1383
  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 react_jsx_runtime13 from "react/jsx-runtime";
6
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
7
7
  import { z } from "zod";
8
8
  import { ISchema } from "@formily/json-schema";
9
9
 
@@ -361,7 +361,7 @@ declare function AutoTableActionBar<TData>({
361
361
  enableDelete,
362
362
  extraActions,
363
363
  actions
364
- }: AutoTableActionBarProps<TData>): react_jsx_runtime13.JSX.Element;
364
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime3.JSX.Element;
365
365
  //#endregion
366
366
  //#region src/lib/schema-bridge/types.d.ts
367
367
  /**
@@ -529,7 +529,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
529
529
  showDefaultExport,
530
530
  onSelectedCountChange,
531
531
  getSelectedRows
532
- }: AutoTableProps<T>): react_jsx_runtime13.JSX.Element;
532
+ }: AutoTableProps<T>): react_jsx_runtime3.JSX.Element;
533
533
  //#endregion
534
534
  //#region src/i18n/locale.d.ts
535
535
  /**
@@ -875,7 +875,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
875
875
  toolbarActions,
876
876
  locale: localeProp,
877
877
  onCreate
878
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime13.JSX.Element;
878
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime3.JSX.Element;
879
879
  //#endregion
880
880
  //#region src/components/auto-crud/auto-form.d.ts
881
881
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -907,7 +907,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
907
907
  labelAlign,
908
908
  labelWidth,
909
909
  showSubmitButton
910
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime13.JSX.Element;
910
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime3.JSX.Element;
911
911
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
912
912
  ref?: React.Ref<AutoFormRef>;
913
913
  }) => ReturnType<typeof AutoFormInner>;
@@ -1209,7 +1209,7 @@ declare function AutoTableSimpleFilters<TData>({
1209
1209
  filters: externalFilters,
1210
1210
  onFiltersChange,
1211
1211
  leading
1212
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime13.JSX.Element | null;
1212
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime3.JSX.Element | null;
1213
1213
  //#endregion
1214
1214
  //#region src/components/auto-crud/form-modal.d.ts
1215
1215
  type ModalVariant = "dialog" | "sheet";
@@ -1251,7 +1251,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1251
1251
  labelAlign,
1252
1252
  labelWidth,
1253
1253
  className
1254
- }: CrudFormModalProps<T>): react_jsx_runtime13.JSX.Element;
1254
+ }: CrudFormModalProps<T>): react_jsx_runtime3.JSX.Element;
1255
1255
  //#endregion
1256
1256
  //#region src/components/auto-crud/import-dialog.d.ts
1257
1257
  interface ImportDialogProps {
@@ -1273,7 +1273,7 @@ declare function ImportDialog({
1273
1273
  columns,
1274
1274
  title,
1275
1275
  locale
1276
- }: ImportDialogProps): react_jsx_runtime13.JSX.Element;
1276
+ }: ImportDialogProps): react_jsx_runtime3.JSX.Element;
1277
1277
  //#endregion
1278
1278
  //#region src/components/auto-crud/export-dialog.d.ts
1279
1279
  type ExportMode = "selected" | "filtered";
@@ -1293,7 +1293,7 @@ declare function ExportDialog({
1293
1293
  selectedCount,
1294
1294
  onExport,
1295
1295
  canExportFiltered
1296
- }: ExportDialogProps): react_jsx_runtime13.JSX.Element;
1296
+ }: ExportDialogProps): react_jsx_runtime3.JSX.Element;
1297
1297
  //#endregion
1298
1298
  //#region src/components/data-table/data-table.d.ts
1299
1299
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1306,7 +1306,7 @@ declare function DataTable<TData>({
1306
1306
  children,
1307
1307
  className,
1308
1308
  ...props
1309
- }: DataTableProps<TData>): react_jsx_runtime13.JSX.Element;
1309
+ }: DataTableProps<TData>): react_jsx_runtime3.JSX.Element;
1310
1310
  //#endregion
1311
1311
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1312
1312
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1317,7 +1317,7 @@ declare function DataTableAdvancedToolbar<TData>({
1317
1317
  children,
1318
1318
  className,
1319
1319
  ...props
1320
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime13.JSX.Element;
1320
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
1321
1321
  //#endregion
1322
1322
  //#region src/components/data-table/data-table-column-header.d.ts
1323
1323
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1329,7 +1329,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1329
1329
  label,
1330
1330
  className,
1331
1331
  ...props
1332
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime13.JSX.Element;
1332
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
1333
1333
  //#endregion
1334
1334
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1335
1335
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1343,7 +1343,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1343
1343
  title,
1344
1344
  options,
1345
1345
  multiple
1346
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime13.JSX.Element;
1346
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
1347
1347
  //#endregion
1348
1348
  //#region src/components/data-table/data-table-pagination.d.ts
1349
1349
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1355,7 +1355,7 @@ declare function DataTablePagination<TData>({
1355
1355
  pageSizeOptions,
1356
1356
  className,
1357
1357
  ...props
1358
- }: DataTablePaginationProps<TData>): react_jsx_runtime13.JSX.Element;
1358
+ }: DataTablePaginationProps<TData>): react_jsx_runtime3.JSX.Element;
1359
1359
  //#endregion
1360
1360
  //#region src/components/data-table/data-table-toolbar.d.ts
1361
1361
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1366,7 +1366,7 @@ declare function DataTableToolbar<TData>({
1366
1366
  children,
1367
1367
  className,
1368
1368
  ...props
1369
- }: DataTableToolbarProps<TData>): react_jsx_runtime13.JSX.Element;
1369
+ }: DataTableToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
1370
1370
  //#endregion
1371
1371
  //#region src/components/data-table/data-table-view-options.d.ts
1372
1372
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1377,7 +1377,7 @@ declare function DataTableViewOptions<TData>({
1377
1377
  table,
1378
1378
  disabled,
1379
1379
  ...props
1380
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime13.JSX.Element;
1380
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime3.JSX.Element;
1381
1381
  //#endregion
1382
1382
  //#region src/hooks/use-data-table.d.ts
1383
1383
  interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
package/dist/index.js CHANGED
@@ -1416,6 +1416,7 @@ function DataTableFilterList({ table, debounceMs = DEBOUNCE_MS$2, throttleMs = T
1416
1416
  const descriptionId = React.useId();
1417
1417
  const [open, setOpen] = React.useState(false);
1418
1418
  const addButtonRef = React.useRef(null);
1419
+ const columnDefs = table.options.columns;
1419
1420
  const columns = React.useMemo(() => {
1420
1421
  return table.getAllColumns().filter((column) => {
1421
1422
  if (!column.getCanFilter()) return false;
@@ -1423,7 +1424,7 @@ function DataTableFilterList({ table, debounceMs = DEBOUNCE_MS$2, throttleMs = T
1423
1424
  if (modes && !modes.includes("advanced")) return false;
1424
1425
  return true;
1425
1426
  });
1426
- }, [table]);
1427
+ }, [table, columnDefs]);
1427
1428
  const [filters, setFilters] = useReadableFilters(columns, { debounceMs });
1428
1429
  const debouncedSetFilters = useDebouncedCallback(setFilters, debounceMs);
1429
1430
  const [joinOperator, setJoinOperator] = useQueryState(table.options.meta?.queryKeys?.joinOperator ?? "", parseAsStringEnum(["and", "or"]).withDefault("and"));
@@ -1910,6 +1911,7 @@ function getOptionCommandValue$2(option) {
1910
1911
  }
1911
1912
  function DataTableFilterMenu({ table, debounceMs = DEBOUNCE_MS$1, throttleMs = THROTTLE_MS$1, shallow = true, disabled,...props }) {
1912
1913
  const id = React.useId();
1914
+ const columnDefs = table.options.columns;
1913
1915
  const columns = React.useMemo(() => {
1914
1916
  return table.getAllColumns().filter((column) => {
1915
1917
  if (!column.columnDef.enableColumnFilter) return false;
@@ -1917,7 +1919,7 @@ function DataTableFilterMenu({ table, debounceMs = DEBOUNCE_MS$1, throttleMs = T
1917
1919
  if (modes && !modes.includes("command")) return false;
1918
1920
  return true;
1919
1921
  });
1920
- }, [table]);
1922
+ }, [table, columnDefs]);
1921
1923
  const [open, setOpen] = React.useState(false);
1922
1924
  const [selectedColumn, setSelectedColumn] = React.useState(null);
1923
1925
  const [inputValue, setInputValue] = React.useState("");
@@ -2673,6 +2675,7 @@ function DataTableViewOptions({ table, disabled,...props }) {
2673
2675
  //#endregion
2674
2676
  //#region src/components/auto-crud/auto-table-simple-filters.tsx
2675
2677
  function AutoTableSimpleFilters({ table, shallow = false, filters: externalFilters, onFiltersChange, leading }) {
2678
+ const columnDefs = table.options.columns;
2676
2679
  const columns = React.useMemo(() => table.getAllColumns().filter((col) => col.getCanFilter()).sort((a, b) => {
2677
2680
  const readOrder = (column) => {
2678
2681
  const metaIndex = column.columnDef.meta?.index;
@@ -2682,7 +2685,7 @@ function AutoTableSimpleFilters({ table, shallow = false, filters: externalFilte
2682
2685
  const orderDiff = readOrder(a) - readOrder(b);
2683
2686
  if (orderDiff !== 0) return orderDiff;
2684
2687
  return a.getIndex() - b.getIndex();
2685
- }), [table]);
2688
+ }), [table, columnDefs]);
2686
2689
  const queryStateOptions = table.options.meta?.queryStateOptions;
2687
2690
  const [queryFilters, setQueryFilters] = useReadableFilters(columns, {
2688
2691
  ...queryStateOptions,
@@ -4714,25 +4717,27 @@ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection
4714
4717
  clearOnDefault: true
4715
4718
  });
4716
4719
  const searchConfig = search && typeof search === "object" ? search : {};
4720
+ const enableAdvancedFilter = true;
4721
+ const columns = useMemo(() => {
4722
+ const dataColumns = createTableSchema(schema, {
4723
+ overrides,
4724
+ exclude
4725
+ });
4726
+ const result = enableRowSelection ? [createSelectColumn(), ...dataColumns] : dataColumns;
4727
+ if (actions) result.push(createActionsColumn(actions));
4728
+ return result;
4729
+ }, [
4730
+ schema,
4731
+ overrides,
4732
+ enableRowSelection,
4733
+ exclude,
4734
+ actions
4735
+ ]);
4717
4736
  const { table, shallow, debounceMs, throttleMs } = useDataTable({
4718
4737
  data,
4719
- columns: useMemo(() => {
4720
- const dataColumns = createTableSchema(schema, {
4721
- overrides,
4722
- exclude
4723
- });
4724
- const result = enableRowSelection ? [createSelectColumn(), ...dataColumns] : dataColumns;
4725
- if (actions) result.push(createActionsColumn(actions));
4726
- return result;
4727
- }, [
4728
- schema,
4729
- overrides,
4730
- enableRowSelection,
4731
- exclude,
4732
- actions
4733
- ]),
4738
+ columns,
4734
4739
  pageCount,
4735
- enableAdvancedFilter: true,
4740
+ enableAdvancedFilter,
4736
4741
  initialState: useMemo(() => ({
4737
4742
  sorting: initialSorting,
4738
4743
  columnPinning: pinnedColumns ?? {
@@ -4818,6 +4823,7 @@ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection
4818
4823
  }, [
4819
4824
  currentMode,
4820
4825
  table,
4826
+ columns,
4821
4827
  shallow,
4822
4828
  searchInput,
4823
4829
  debounceMs,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wordrhyme/auto-crud",
3
3
  "type": "module",
4
- "version": "1.1.5",
4
+ "version": "1.1.6",
5
5
  "description": "Schema-first CRUD components with auto-generated tables and forms",
6
6
  "author": "wordrhyme",
7
7
  "license": "MIT",
@@ -82,11 +82,11 @@
82
82
  "react-dom": "19.2.4",
83
83
  "tsdown": "^0.15.12",
84
84
  "typescript": "^5.9.3",
85
- "@internal/eslint-config": "0.3.0",
86
85
  "@internal/prettier-config": "0.0.1",
87
- "@internal/tsconfig": "0.1.0",
86
+ "@internal/eslint-config": "0.3.0",
88
87
  "@internal/tsdown-config": "0.1.0",
89
- "@internal/vitest-config": "0.1.0"
88
+ "@internal/vitest-config": "0.1.0",
89
+ "@internal/tsconfig": "0.1.0"
90
90
  },
91
91
  "prettier": "@internal/prettier-config",
92
92
  "scripts": {