@wordrhyme/auto-crud 1.1.4 → 1.1.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 CHANGED
@@ -1065,6 +1065,7 @@ function FacetedItem(props) {
1065
1065
  else if (context.onItemSelect) context.onItemSelect(currentValue);
1066
1066
  }, [onSelect, context]);
1067
1067
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CommandItem, {
1068
+ value,
1068
1069
  "aria-selected": isSelected,
1069
1070
  "data-selected": isSelected,
1070
1071
  className: cn("gap-2", className),
@@ -1943,6 +1944,13 @@ const DEBOUNCE_MS$1 = 300;
1943
1944
  const THROTTLE_MS$1 = 50;
1944
1945
  const FILTER_SHORTCUT_KEY = "f";
1945
1946
  const REMOVE_FILTER_SHORTCUTS = ["backspace", "delete"];
1947
+ function getOptionCommandValue$2(option) {
1948
+ return [
1949
+ option.value,
1950
+ option.label,
1951
+ option.searchText
1952
+ ].filter(Boolean).join(" ");
1953
+ }
1946
1954
  function DataTableFilterMenu({ table, debounceMs = DEBOUNCE_MS$1, throttleMs = THROTTLE_MS$1, shallow = true, disabled,...props }) {
1947
1955
  const id = react.useId();
1948
1956
  const columns = react.useMemo(() => {
@@ -2221,7 +2229,7 @@ function FilterValueSelector({ column, value, onSelect }) {
2221
2229
  })] });
2222
2230
  case "select":
2223
2231
  case "multiSelect": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandGroup, { children: column.columnDef.meta?.options?.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CommandItem, {
2224
- value: option.value,
2232
+ value: getOptionCommandValue$2(option),
2225
2233
  onSelect: () => onSelect(option.value),
2226
2234
  children: [
2227
2235
  option.icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(option.icon, {}),
@@ -2348,7 +2356,7 @@ function onFilterInputRender({ filter, column, inputId, onFilterUpdate, showValu
2348
2356
  align: "start",
2349
2357
  className: "w-48 p-0",
2350
2358
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Command, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandInput, { placeholder: "Search options..." }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CommandList, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandEmpty, { children: "No options found." }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandGroup, { children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CommandItem, {
2351
- value: option.value,
2359
+ value: getOptionCommandValue$2(option),
2352
2360
  onSelect: () => {
2353
2361
  const value = filter.variant === "multiSelect" ? selectedValues.includes(option.value) ? selectedValues.filter((v) => v !== option.value) : [...selectedValues, option.value] : option.value;
2354
2362
  onFilterUpdate(filter.filterId, { value });
@@ -2951,6 +2959,13 @@ function AutoTableSimpleFilters({ table, shallow = false, filters: externalFilte
2951
2959
  ]
2952
2960
  });
2953
2961
  }
2962
+ function getOptionCommandValue$1(option) {
2963
+ return [
2964
+ option.value,
2965
+ option.label,
2966
+ option.searchText
2967
+ ].filter(Boolean).join(" ");
2968
+ }
2954
2969
  function SimpleFacetedFilter({ title, options, multiple, value, onChange }) {
2955
2970
  const [open, setOpen] = react.useState(false);
2956
2971
  const selectedValues = react.useMemo(() => new Set(value), [value]);
@@ -3030,6 +3045,7 @@ function SimpleFacetedFilter({ title, options, multiple, value, onChange }) {
3030
3045
  children: options.map((option) => {
3031
3046
  const isSelected = selectedValues.has(option.value);
3032
3047
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CommandItem, {
3048
+ value: getOptionCommandValue$1(option),
3033
3049
  onSelect: () => onItemSelect(option, isSelected),
3034
3050
  children: [
3035
3051
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -5054,7 +5070,7 @@ function createEditFormSchema(schema, options) {
5054
5070
 
5055
5071
  //#endregion
5056
5072
  //#region src/components/auto-crud/auto-form.tsx
5057
- const COMBOBOX_LIST_CLASS = "[&_[cmdk-list]]:max-h-[360px]";
5073
+ const COMBOBOX_LIST_CLASS = "[&_[cmdk-list]]:max-h-[360px] [&_[cmdk-list]]:overflow-x-hidden [&_[cmdk-list]]:overflow-y-auto";
5058
5074
  const FormilySwitch = (0, __formily_react.connect)(__pixpilot_shadcn.Switch, (0, __formily_react.mapProps)({
5059
5075
  value: "checked",
5060
5076
  onInput: "onCheckedChange"
@@ -5926,6 +5942,28 @@ function ImportDialog({ open, onOpenChange, onImport, columns = [], title, local
5926
5942
 
5927
5943
  //#endregion
5928
5944
  //#region src/components/auto-crud/auto-crud-table.tsx
5945
+ function mergeFieldPart(base, override) {
5946
+ if (override === void 0) return base;
5947
+ if (override === false || base === false || typeof base !== "object" || typeof override !== "object" || base === null || override === null || Array.isArray(base) || Array.isArray(override)) return override;
5948
+ return {
5949
+ ...base,
5950
+ ...override
5951
+ };
5952
+ }
5953
+ function mergeFieldConfig(base, override) {
5954
+ return {
5955
+ ...base,
5956
+ ...override,
5957
+ table: mergeFieldPart(base?.table, override?.table),
5958
+ filter: mergeFieldPart(base?.filter, override?.filter),
5959
+ form: mergeFieldPart(base?.form, override?.form)
5960
+ };
5961
+ }
5962
+ function mergeFields(base, override) {
5963
+ if (!base && !override) return void 0;
5964
+ const keys = new Set([...Object.keys(base ?? {}), ...Object.keys(override ?? {})]);
5965
+ return Object.fromEntries(Array.from(keys).map((key) => [key, mergeFieldConfig(base?.[key], override?.[key])]));
5966
+ }
5929
5967
  /**
5930
5968
  * 从统一配置生成表格 overrides
5931
5969
  * 当 filter 配置存在时,合并到 meta 中(不影响列隐藏)
@@ -6218,10 +6256,7 @@ function resolveActions(actionsOrFn, defaults, rowActionsLocale) {
6218
6256
  function AutoCrudTable({ title, description, schema, resource, fields, table: tableConfig, form: formConfig, permissions, actions: actionItems, toolbarActions, locale: localeProp, onCreate }) {
6219
6257
  const locale = resolveLocale(localeProp);
6220
6258
  const resolvedSchema = resource.schema ?? schema;
6221
- const resolvedFields = react.useMemo(() => ({
6222
- ...fields,
6223
- ...resource.fields
6224
- }), [fields, resource.fields]);
6259
+ const resolvedFields = react.useMemo(() => mergeFields(resource.fields, fields) ?? {}, [fields, resource.fields]);
6225
6260
  const can = {
6226
6261
  create: permissions?.can?.create ?? true,
6227
6262
  update: permissions?.can?.update ?? true,
@@ -6545,6 +6580,13 @@ function DataTableAdvancedToolbar({ table, children, className,...props }) {
6545
6580
 
6546
6581
  //#endregion
6547
6582
  //#region src/components/data-table/data-table-faceted-filter.tsx
6583
+ function getOptionCommandValue(option) {
6584
+ return [
6585
+ option.value,
6586
+ option.label,
6587
+ option.searchText
6588
+ ].filter(Boolean).join(" ");
6589
+ }
6548
6590
  function DataTableFacetedFilter({ column, title, options, multiple }) {
6549
6591
  const [open, setOpen] = react.useState(false);
6550
6592
  const columnFilterValue = column?.getFilterValue();
@@ -6626,6 +6668,7 @@ function DataTableFacetedFilter({ column, title, options, multiple }) {
6626
6668
  children: options.map((option) => {
6627
6669
  const isSelected = selectedValues.has(option.value);
6628
6670
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CommandItem, {
6671
+ value: getOptionCommandValue(option),
6629
6672
  onSelect: () => onItemSelect(option, isSelected),
6630
6673
  children: [
6631
6674
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime2 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_runtime0.JSX.Element;
364
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime2.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_runtime0.JSX.Element;
532
+ }: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
533
533
  //#endregion
534
534
  //#region src/i18n/locale.d.ts
535
535
  /**
@@ -635,6 +635,7 @@ interface FilterConfig {
635
635
  options?: Array<{
636
636
  label: string;
637
637
  value: string;
638
+ searchText?: string;
638
639
  count?: number;
639
640
  icon?: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
640
641
  }>;
@@ -874,7 +875,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
874
875
  toolbarActions,
875
876
  locale: localeProp,
876
877
  onCreate
877
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime0.JSX.Element;
878
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
878
879
  //#endregion
879
880
  //#region src/components/auto-crud/auto-form.d.ts
880
881
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -882,11 +883,11 @@ interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
882
883
  initialValues?: Partial<z.infer<T>>;
883
884
  onSubmit: (values: z.infer<T>) => void | Promise<void>;
884
885
  overrides?: FormSchemaOverrides;
885
- mode?: "create" | "edit";
886
+ mode?: 'create' | 'edit';
886
887
  loading?: boolean;
887
888
  gridColumns?: number;
888
889
  /** Label 对齐方式 */
889
- labelAlign?: "left" | "top" | "right";
890
+ labelAlign?: 'left' | 'top' | 'right';
890
891
  /** Label 宽度(labelAlign 为 left 时有效) */
891
892
  labelWidth?: number | string;
892
893
  /** 是否显示提交按钮(默认 true) */
@@ -906,7 +907,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
906
907
  labelAlign,
907
908
  labelWidth,
908
909
  showSubmitButton
909
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime0.JSX.Element;
910
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
910
911
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
911
912
  ref?: React.Ref<AutoFormRef>;
912
913
  }) => ReturnType<typeof AutoFormInner>;
@@ -1176,6 +1177,7 @@ interface QueryKeys {
1176
1177
  interface Option {
1177
1178
  label: string;
1178
1179
  value: string;
1180
+ searchText?: string;
1179
1181
  count?: number;
1180
1182
  icon?: React.FC<React.SVGProps<SVGSVGElement>>;
1181
1183
  }
@@ -1207,7 +1209,7 @@ declare function AutoTableSimpleFilters<TData>({
1207
1209
  filters: externalFilters,
1208
1210
  onFiltersChange,
1209
1211
  leading
1210
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime0.JSX.Element | null;
1212
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime2.JSX.Element | null;
1211
1213
  //#endregion
1212
1214
  //#region src/components/auto-crud/form-modal.d.ts
1213
1215
  type ModalVariant = "dialog" | "sheet";
@@ -1249,7 +1251,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1249
1251
  labelAlign,
1250
1252
  labelWidth,
1251
1253
  className
1252
- }: CrudFormModalProps<T>): react_jsx_runtime0.JSX.Element;
1254
+ }: CrudFormModalProps<T>): react_jsx_runtime2.JSX.Element;
1253
1255
  //#endregion
1254
1256
  //#region src/components/auto-crud/import-dialog.d.ts
1255
1257
  interface ImportDialogProps {
@@ -1271,7 +1273,7 @@ declare function ImportDialog({
1271
1273
  columns,
1272
1274
  title,
1273
1275
  locale
1274
- }: ImportDialogProps): react_jsx_runtime0.JSX.Element;
1276
+ }: ImportDialogProps): react_jsx_runtime2.JSX.Element;
1275
1277
  //#endregion
1276
1278
  //#region src/components/auto-crud/export-dialog.d.ts
1277
1279
  type ExportMode = "selected" | "filtered";
@@ -1291,7 +1293,7 @@ declare function ExportDialog({
1291
1293
  selectedCount,
1292
1294
  onExport,
1293
1295
  canExportFiltered
1294
- }: ExportDialogProps): react_jsx_runtime0.JSX.Element;
1296
+ }: ExportDialogProps): react_jsx_runtime2.JSX.Element;
1295
1297
  //#endregion
1296
1298
  //#region src/components/data-table/data-table.d.ts
1297
1299
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1304,7 +1306,7 @@ declare function DataTable<TData>({
1304
1306
  children,
1305
1307
  className,
1306
1308
  ...props
1307
- }: DataTableProps<TData>): react_jsx_runtime0.JSX.Element;
1309
+ }: DataTableProps<TData>): react_jsx_runtime2.JSX.Element;
1308
1310
  //#endregion
1309
1311
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1310
1312
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1315,7 +1317,7 @@ declare function DataTableAdvancedToolbar<TData>({
1315
1317
  children,
1316
1318
  className,
1317
1319
  ...props
1318
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1320
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1319
1321
  //#endregion
1320
1322
  //#region src/components/data-table/data-table-column-header.d.ts
1321
1323
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1327,7 +1329,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1327
1329
  label,
1328
1330
  className,
1329
1331
  ...props
1330
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1332
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1331
1333
  //#endregion
1332
1334
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1333
1335
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1341,7 +1343,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1341
1343
  title,
1342
1344
  options,
1343
1345
  multiple
1344
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1346
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1345
1347
  //#endregion
1346
1348
  //#region src/components/data-table/data-table-pagination.d.ts
1347
1349
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1353,7 +1355,7 @@ declare function DataTablePagination<TData>({
1353
1355
  pageSizeOptions,
1354
1356
  className,
1355
1357
  ...props
1356
- }: DataTablePaginationProps<TData>): react_jsx_runtime0.JSX.Element;
1358
+ }: DataTablePaginationProps<TData>): react_jsx_runtime2.JSX.Element;
1357
1359
  //#endregion
1358
1360
  //#region src/components/data-table/data-table-toolbar.d.ts
1359
1361
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1364,7 +1366,7 @@ declare function DataTableToolbar<TData>({
1364
1366
  children,
1365
1367
  className,
1366
1368
  ...props
1367
- }: DataTableToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1369
+ }: DataTableToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1368
1370
  //#endregion
1369
1371
  //#region src/components/data-table/data-table-view-options.d.ts
1370
1372
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1375,7 +1377,7 @@ declare function DataTableViewOptions<TData>({
1375
1377
  table,
1376
1378
  disabled,
1377
1379
  ...props
1378
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime0.JSX.Element;
1380
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime2.JSX.Element;
1379
1381
  //#endregion
1380
1382
  //#region src/hooks/use-data-table.d.ts
1381
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_runtime0 from "react/jsx-runtime";
6
+ import * as react_jsx_runtime13 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_runtime0.JSX.Element;
364
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime13.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_runtime0.JSX.Element;
532
+ }: AutoTableProps<T>): react_jsx_runtime13.JSX.Element;
533
533
  //#endregion
534
534
  //#region src/i18n/locale.d.ts
535
535
  /**
@@ -635,6 +635,7 @@ interface FilterConfig {
635
635
  options?: Array<{
636
636
  label: string;
637
637
  value: string;
638
+ searchText?: string;
638
639
  count?: number;
639
640
  icon?: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
640
641
  }>;
@@ -874,7 +875,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
874
875
  toolbarActions,
875
876
  locale: localeProp,
876
877
  onCreate
877
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime0.JSX.Element;
878
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime13.JSX.Element;
878
879
  //#endregion
879
880
  //#region src/components/auto-crud/auto-form.d.ts
880
881
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -882,11 +883,11 @@ interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
882
883
  initialValues?: Partial<z.infer<T>>;
883
884
  onSubmit: (values: z.infer<T>) => void | Promise<void>;
884
885
  overrides?: FormSchemaOverrides;
885
- mode?: "create" | "edit";
886
+ mode?: 'create' | 'edit';
886
887
  loading?: boolean;
887
888
  gridColumns?: number;
888
889
  /** Label 对齐方式 */
889
- labelAlign?: "left" | "top" | "right";
890
+ labelAlign?: 'left' | 'top' | 'right';
890
891
  /** Label 宽度(labelAlign 为 left 时有效) */
891
892
  labelWidth?: number | string;
892
893
  /** 是否显示提交按钮(默认 true) */
@@ -906,7 +907,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
906
907
  labelAlign,
907
908
  labelWidth,
908
909
  showSubmitButton
909
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime0.JSX.Element;
910
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime13.JSX.Element;
910
911
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
911
912
  ref?: React.Ref<AutoFormRef>;
912
913
  }) => ReturnType<typeof AutoFormInner>;
@@ -1176,6 +1177,7 @@ interface QueryKeys {
1176
1177
  interface Option {
1177
1178
  label: string;
1178
1179
  value: string;
1180
+ searchText?: string;
1179
1181
  count?: number;
1180
1182
  icon?: React.FC<React.SVGProps<SVGSVGElement>>;
1181
1183
  }
@@ -1207,7 +1209,7 @@ declare function AutoTableSimpleFilters<TData>({
1207
1209
  filters: externalFilters,
1208
1210
  onFiltersChange,
1209
1211
  leading
1210
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime0.JSX.Element | null;
1212
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime13.JSX.Element | null;
1211
1213
  //#endregion
1212
1214
  //#region src/components/auto-crud/form-modal.d.ts
1213
1215
  type ModalVariant = "dialog" | "sheet";
@@ -1249,7 +1251,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1249
1251
  labelAlign,
1250
1252
  labelWidth,
1251
1253
  className
1252
- }: CrudFormModalProps<T>): react_jsx_runtime0.JSX.Element;
1254
+ }: CrudFormModalProps<T>): react_jsx_runtime13.JSX.Element;
1253
1255
  //#endregion
1254
1256
  //#region src/components/auto-crud/import-dialog.d.ts
1255
1257
  interface ImportDialogProps {
@@ -1271,7 +1273,7 @@ declare function ImportDialog({
1271
1273
  columns,
1272
1274
  title,
1273
1275
  locale
1274
- }: ImportDialogProps): react_jsx_runtime0.JSX.Element;
1276
+ }: ImportDialogProps): react_jsx_runtime13.JSX.Element;
1275
1277
  //#endregion
1276
1278
  //#region src/components/auto-crud/export-dialog.d.ts
1277
1279
  type ExportMode = "selected" | "filtered";
@@ -1291,7 +1293,7 @@ declare function ExportDialog({
1291
1293
  selectedCount,
1292
1294
  onExport,
1293
1295
  canExportFiltered
1294
- }: ExportDialogProps): react_jsx_runtime0.JSX.Element;
1296
+ }: ExportDialogProps): react_jsx_runtime13.JSX.Element;
1295
1297
  //#endregion
1296
1298
  //#region src/components/data-table/data-table.d.ts
1297
1299
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1304,7 +1306,7 @@ declare function DataTable<TData>({
1304
1306
  children,
1305
1307
  className,
1306
1308
  ...props
1307
- }: DataTableProps<TData>): react_jsx_runtime0.JSX.Element;
1309
+ }: DataTableProps<TData>): react_jsx_runtime13.JSX.Element;
1308
1310
  //#endregion
1309
1311
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1310
1312
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1315,7 +1317,7 @@ declare function DataTableAdvancedToolbar<TData>({
1315
1317
  children,
1316
1318
  className,
1317
1319
  ...props
1318
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1320
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime13.JSX.Element;
1319
1321
  //#endregion
1320
1322
  //#region src/components/data-table/data-table-column-header.d.ts
1321
1323
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1327,7 +1329,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1327
1329
  label,
1328
1330
  className,
1329
1331
  ...props
1330
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1332
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime13.JSX.Element;
1331
1333
  //#endregion
1332
1334
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1333
1335
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1341,7 +1343,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1341
1343
  title,
1342
1344
  options,
1343
1345
  multiple
1344
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1346
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime13.JSX.Element;
1345
1347
  //#endregion
1346
1348
  //#region src/components/data-table/data-table-pagination.d.ts
1347
1349
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1353,7 +1355,7 @@ declare function DataTablePagination<TData>({
1353
1355
  pageSizeOptions,
1354
1356
  className,
1355
1357
  ...props
1356
- }: DataTablePaginationProps<TData>): react_jsx_runtime0.JSX.Element;
1358
+ }: DataTablePaginationProps<TData>): react_jsx_runtime13.JSX.Element;
1357
1359
  //#endregion
1358
1360
  //#region src/components/data-table/data-table-toolbar.d.ts
1359
1361
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1364,7 +1366,7 @@ declare function DataTableToolbar<TData>({
1364
1366
  children,
1365
1367
  className,
1366
1368
  ...props
1367
- }: DataTableToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1369
+ }: DataTableToolbarProps<TData>): react_jsx_runtime13.JSX.Element;
1368
1370
  //#endregion
1369
1371
  //#region src/components/data-table/data-table-view-options.d.ts
1370
1372
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1375,7 +1377,7 @@ declare function DataTableViewOptions<TData>({
1375
1377
  table,
1376
1378
  disabled,
1377
1379
  ...props
1378
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime0.JSX.Element;
1380
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime13.JSX.Element;
1379
1381
  //#endregion
1380
1382
  //#region src/hooks/use-data-table.d.ts
1381
1383
  interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
package/dist/index.js CHANGED
@@ -1022,6 +1022,7 @@ function FacetedItem(props) {
1022
1022
  else if (context.onItemSelect) context.onItemSelect(currentValue);
1023
1023
  }, [onSelect, context]);
1024
1024
  return /* @__PURE__ */ jsxs(CommandItem, {
1025
+ value,
1025
1026
  "aria-selected": isSelected,
1026
1027
  "data-selected": isSelected,
1027
1028
  className: cn("gap-2", className),
@@ -1900,6 +1901,13 @@ const DEBOUNCE_MS$1 = 300;
1900
1901
  const THROTTLE_MS$1 = 50;
1901
1902
  const FILTER_SHORTCUT_KEY = "f";
1902
1903
  const REMOVE_FILTER_SHORTCUTS = ["backspace", "delete"];
1904
+ function getOptionCommandValue$2(option) {
1905
+ return [
1906
+ option.value,
1907
+ option.label,
1908
+ option.searchText
1909
+ ].filter(Boolean).join(" ");
1910
+ }
1903
1911
  function DataTableFilterMenu({ table, debounceMs = DEBOUNCE_MS$1, throttleMs = THROTTLE_MS$1, shallow = true, disabled,...props }) {
1904
1912
  const id = React.useId();
1905
1913
  const columns = React.useMemo(() => {
@@ -2178,7 +2186,7 @@ function FilterValueSelector({ column, value, onSelect }) {
2178
2186
  })] });
2179
2187
  case "select":
2180
2188
  case "multiSelect": return /* @__PURE__ */ jsx(CommandGroup, { children: column.columnDef.meta?.options?.map((option) => /* @__PURE__ */ jsxs(CommandItem, {
2181
- value: option.value,
2189
+ value: getOptionCommandValue$2(option),
2182
2190
  onSelect: () => onSelect(option.value),
2183
2191
  children: [
2184
2192
  option.icon && /* @__PURE__ */ jsx(option.icon, {}),
@@ -2305,7 +2313,7 @@ function onFilterInputRender({ filter, column, inputId, onFilterUpdate, showValu
2305
2313
  align: "start",
2306
2314
  className: "w-48 p-0",
2307
2315
  children: /* @__PURE__ */ jsxs(Command, { children: [/* @__PURE__ */ jsx(CommandInput, { placeholder: "Search options..." }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No options found." }), /* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsxs(CommandItem, {
2308
- value: option.value,
2316
+ value: getOptionCommandValue$2(option),
2309
2317
  onSelect: () => {
2310
2318
  const value = filter.variant === "multiSelect" ? selectedValues.includes(option.value) ? selectedValues.filter((v) => v !== option.value) : [...selectedValues, option.value] : option.value;
2311
2319
  onFilterUpdate(filter.filterId, { value });
@@ -2908,6 +2916,13 @@ function AutoTableSimpleFilters({ table, shallow = false, filters: externalFilte
2908
2916
  ]
2909
2917
  });
2910
2918
  }
2919
+ function getOptionCommandValue$1(option) {
2920
+ return [
2921
+ option.value,
2922
+ option.label,
2923
+ option.searchText
2924
+ ].filter(Boolean).join(" ");
2925
+ }
2911
2926
  function SimpleFacetedFilter({ title, options, multiple, value, onChange }) {
2912
2927
  const [open, setOpen] = React.useState(false);
2913
2928
  const selectedValues = React.useMemo(() => new Set(value), [value]);
@@ -2987,6 +3002,7 @@ function SimpleFacetedFilter({ title, options, multiple, value, onChange }) {
2987
3002
  children: options.map((option) => {
2988
3003
  const isSelected = selectedValues.has(option.value);
2989
3004
  return /* @__PURE__ */ jsxs(CommandItem, {
3005
+ value: getOptionCommandValue$1(option),
2990
3006
  onSelect: () => onItemSelect(option, isSelected),
2991
3007
  children: [
2992
3008
  /* @__PURE__ */ jsx("div", {
@@ -5011,7 +5027,7 @@ function createEditFormSchema(schema, options) {
5011
5027
 
5012
5028
  //#endregion
5013
5029
  //#region src/components/auto-crud/auto-form.tsx
5014
- const COMBOBOX_LIST_CLASS = "[&_[cmdk-list]]:max-h-[360px]";
5030
+ const COMBOBOX_LIST_CLASS = "[&_[cmdk-list]]:max-h-[360px] [&_[cmdk-list]]:overflow-x-hidden [&_[cmdk-list]]:overflow-y-auto";
5015
5031
  const FormilySwitch = connect(Switch, mapProps({
5016
5032
  value: "checked",
5017
5033
  onInput: "onCheckedChange"
@@ -5883,6 +5899,28 @@ function ImportDialog({ open, onOpenChange, onImport, columns = [], title, local
5883
5899
 
5884
5900
  //#endregion
5885
5901
  //#region src/components/auto-crud/auto-crud-table.tsx
5902
+ function mergeFieldPart(base, override) {
5903
+ if (override === void 0) return base;
5904
+ if (override === false || base === false || typeof base !== "object" || typeof override !== "object" || base === null || override === null || Array.isArray(base) || Array.isArray(override)) return override;
5905
+ return {
5906
+ ...base,
5907
+ ...override
5908
+ };
5909
+ }
5910
+ function mergeFieldConfig(base, override) {
5911
+ return {
5912
+ ...base,
5913
+ ...override,
5914
+ table: mergeFieldPart(base?.table, override?.table),
5915
+ filter: mergeFieldPart(base?.filter, override?.filter),
5916
+ form: mergeFieldPart(base?.form, override?.form)
5917
+ };
5918
+ }
5919
+ function mergeFields(base, override) {
5920
+ if (!base && !override) return void 0;
5921
+ const keys = new Set([...Object.keys(base ?? {}), ...Object.keys(override ?? {})]);
5922
+ return Object.fromEntries(Array.from(keys).map((key) => [key, mergeFieldConfig(base?.[key], override?.[key])]));
5923
+ }
5886
5924
  /**
5887
5925
  * 从统一配置生成表格 overrides
5888
5926
  * 当 filter 配置存在时,合并到 meta 中(不影响列隐藏)
@@ -6175,10 +6213,7 @@ function resolveActions(actionsOrFn, defaults, rowActionsLocale) {
6175
6213
  function AutoCrudTable({ title, description, schema, resource, fields, table: tableConfig, form: formConfig, permissions, actions: actionItems, toolbarActions, locale: localeProp, onCreate }) {
6176
6214
  const locale = resolveLocale(localeProp);
6177
6215
  const resolvedSchema = resource.schema ?? schema;
6178
- const resolvedFields = React.useMemo(() => ({
6179
- ...fields,
6180
- ...resource.fields
6181
- }), [fields, resource.fields]);
6216
+ const resolvedFields = React.useMemo(() => mergeFields(resource.fields, fields) ?? {}, [fields, resource.fields]);
6182
6217
  const can = {
6183
6218
  create: permissions?.can?.create ?? true,
6184
6219
  update: permissions?.can?.update ?? true,
@@ -6502,6 +6537,13 @@ function DataTableAdvancedToolbar({ table, children, className,...props }) {
6502
6537
 
6503
6538
  //#endregion
6504
6539
  //#region src/components/data-table/data-table-faceted-filter.tsx
6540
+ function getOptionCommandValue(option) {
6541
+ return [
6542
+ option.value,
6543
+ option.label,
6544
+ option.searchText
6545
+ ].filter(Boolean).join(" ");
6546
+ }
6505
6547
  function DataTableFacetedFilter({ column, title, options, multiple }) {
6506
6548
  const [open, setOpen] = React.useState(false);
6507
6549
  const columnFilterValue = column?.getFilterValue();
@@ -6583,6 +6625,7 @@ function DataTableFacetedFilter({ column, title, options, multiple }) {
6583
6625
  children: options.map((option) => {
6584
6626
  const isSelected = selectedValues.has(option.value);
6585
6627
  return /* @__PURE__ */ jsxs(CommandItem, {
6628
+ value: getOptionCommandValue(option),
6586
6629
  onSelect: () => onItemSelect(option, isSelected),
6587
6630
  children: [
6588
6631
  /* @__PURE__ */ jsx("div", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wordrhyme/auto-crud",
3
3
  "type": "module",
4
- "version": "1.1.4",
4
+ "version": "1.1.5",
5
5
  "description": "Schema-first CRUD components with auto-generated tables and forms",
6
6
  "author": "wordrhyme",
7
7
  "license": "MIT",
@@ -82,8 +82,8 @@
82
82
  "react-dom": "19.2.4",
83
83
  "tsdown": "^0.15.12",
84
84
  "typescript": "^5.9.3",
85
- "@internal/prettier-config": "0.0.1",
86
85
  "@internal/eslint-config": "0.3.0",
86
+ "@internal/prettier-config": "0.0.1",
87
87
  "@internal/tsconfig": "0.1.0",
88
88
  "@internal/tsdown-config": "0.1.0",
89
89
  "@internal/vitest-config": "0.1.0"