@wordrhyme/auto-crud 1.17.0 → 1.17.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/dist/index.cjs CHANGED
@@ -1794,6 +1794,7 @@ function ViewMenu({ resourceId, table, fieldsReady = true, selector = "dropdown"
1794
1794
  "aria-hidden": "true",
1795
1795
  className: cn("pointer-events-none absolute inset-x-0 h-1 bg-primary", linePosition === "top" ? "top-0" : "bottom-0", tabs?.classNames?.indicator)
1796
1796
  }) : null;
1797
+ const triggerLabel = display === "tabs" ? "视图设置" : selected === null ? "切换视图" : void 0;
1797
1798
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [children(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1798
1799
  className: "flex min-w-0 flex-wrap items-center gap-2",
1799
1800
  children: [
@@ -1837,19 +1838,22 @@ function ViewMenu({ resourceId, table, fieldsReady = true, selector = "dropdown"
1837
1838
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Button, {
1838
1839
  type: "button",
1839
1840
  variant: display === "tabs" ? "ghost" : "outline",
1840
- size: display === "tabs" ? "icon-sm" : "sm",
1841
- className: "shrink-0",
1842
- "aria-label": display === "tabs" ? "视图设置" : void 0,
1843
- title: display === "tabs" ? "视图设置" : void 0,
1841
+ size: display === "tabs" || selected === null ? "icon-sm" : "sm",
1842
+ className: cn("relative shrink-0", display === "dropdown" && selected === null && counts && "w-auto px-2"),
1843
+ "aria-label": triggerLabel,
1844
+ title: triggerLabel,
1844
1845
  disabled: !fieldsReady || views.isPending || mutation.isPending,
1845
1846
  children: display === "tabs" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Settings, { className: "size-4" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1846
- selected?.name ?? "全部",
1847
+ selected ? selected.name : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Layers, {
1848
+ "aria-hidden": "true",
1849
+ className: "size-4"
1850
+ }),
1847
1851
  renderCount(selected ? `view:${views.data?.findIndex((view) => view.id === selected.id)}` : "all"),
1848
1852
  dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1849
1853
  "aria-label": "有未保存修改",
1850
- className: "size-1.5 rounded-full bg-current"
1854
+ className: cn("size-1.5 rounded-full bg-current", selected === null && "absolute right-1 top-1")
1851
1855
  }),
1852
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "size-4" })
1856
+ selected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "size-4" })
1853
1857
  ] })
1854
1858
  })
1855
1859
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn.DropdownMenuContent, {
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { Fragment, createContext, forwardRef, useCallback, useContext, useEffect
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
5
  import { keepPreviousData, useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
6
6
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Badge, Button, Calendar, Checkbox, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, Label, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, Select as Select$1, SelectContent, SelectItem, SelectTrigger, SelectValue, Separator, Slider, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Textarea, ToggleGroup, ToggleGroupItem, cn as cn$1 } from "@wordrhyme/shadcn";
7
- import { AppWindow, ArrowDownUp, BadgeCheck, CalendarIcon, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, ChevronRightIcon, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsRightIcon, ChevronsUpDown, CommandIcon, Copy, Download, Ellipsis, EyeOff, FileDown, FileSpreadsheetIcon, GripVertical, Info, List, ListFilter, ListFilterIcon, Loader2, PanelsTopLeft, Pencil, Plus, PlusCircle, RefreshCw, Search, Settings, Settings2, Text, Trash2, Upload, X, XCircle } from "lucide-react";
7
+ import { AppWindow, ArrowDownUp, BadgeCheck, CalendarIcon, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, ChevronRightIcon, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsRightIcon, ChevronsUpDown, CommandIcon, Copy, Download, Ellipsis, EyeOff, FileDown, FileSpreadsheetIcon, GripVertical, Info, Layers, List, ListFilter, ListFilterIcon, Loader2, PanelsTopLeft, Pencil, Plus, PlusCircle, RefreshCw, Search, Settings, Settings2, Text, Trash2, Upload, X, XCircle } from "lucide-react";
8
8
  import { z } from "zod";
9
9
  import { clsx } from "clsx";
10
10
  import { twMerge } from "tailwind-merge";
@@ -1778,6 +1778,7 @@ function ViewMenu({ resourceId, table, fieldsReady = true, selector = "dropdown"
1778
1778
  "aria-hidden": "true",
1779
1779
  className: cn("pointer-events-none absolute inset-x-0 h-1 bg-primary", linePosition === "top" ? "top-0" : "bottom-0", tabs?.classNames?.indicator)
1780
1780
  }) : null;
1781
+ const triggerLabel = display === "tabs" ? "视图设置" : selected === null ? "切换视图" : void 0;
1781
1782
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [children(/* @__PURE__ */ jsxs("div", {
1782
1783
  className: "flex min-w-0 flex-wrap items-center gap-2",
1783
1784
  children: [
@@ -1821,19 +1822,22 @@ function ViewMenu({ resourceId, table, fieldsReady = true, selector = "dropdown"
1821
1822
  children: /* @__PURE__ */ jsx(Button, {
1822
1823
  type: "button",
1823
1824
  variant: display === "tabs" ? "ghost" : "outline",
1824
- size: display === "tabs" ? "icon-sm" : "sm",
1825
- className: "shrink-0",
1826
- "aria-label": display === "tabs" ? "视图设置" : void 0,
1827
- title: display === "tabs" ? "视图设置" : void 0,
1825
+ size: display === "tabs" || selected === null ? "icon-sm" : "sm",
1826
+ className: cn("relative shrink-0", display === "dropdown" && selected === null && counts && "w-auto px-2"),
1827
+ "aria-label": triggerLabel,
1828
+ title: triggerLabel,
1828
1829
  disabled: !fieldsReady || views.isPending || mutation.isPending,
1829
1830
  children: display === "tabs" ? /* @__PURE__ */ jsx(Settings, { className: "size-4" }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
1830
- selected?.name ?? "全部",
1831
+ selected ? selected.name : /* @__PURE__ */ jsx(Layers, {
1832
+ "aria-hidden": "true",
1833
+ className: "size-4"
1834
+ }),
1831
1835
  renderCount(selected ? `view:${views.data?.findIndex((view) => view.id === selected.id)}` : "all"),
1832
1836
  dirty && /* @__PURE__ */ jsx("span", {
1833
1837
  "aria-label": "有未保存修改",
1834
- className: "size-1.5 rounded-full bg-current"
1838
+ className: cn("size-1.5 rounded-full bg-current", selected === null && "absolute right-1 top-1")
1835
1839
  }),
1836
- /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" })
1840
+ selected && /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" })
1837
1841
  ] })
1838
1842
  })
1839
1843
  }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wordrhyme/auto-crud",
3
3
  "type": "module",
4
- "version": "1.17.0",
4
+ "version": "1.17.1",
5
5
  "description": "Schema-first CRUD components with auto-generated tables and forms",
6
6
  "author": "wordrhyme",
7
7
  "license": "MIT",
@@ -71,9 +71,9 @@
71
71
  "nanoid": "^5.1.6",
72
72
  "tailwind-merge": "^3.5.0",
73
73
  "vaul": "^1.1.2",
74
+ "@wordrhyme/formily-shadcn": "2.1.3",
74
75
  "@wordrhyme/shadcn": "2.0.2",
75
- "@wordrhyme/shadcn-ui": "2.1.3",
76
- "@wordrhyme/formily-shadcn": "2.1.3"
76
+ "@wordrhyme/shadcn-ui": "2.1.3"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@storybook/react": "^8.6.18",