@wordrhyme/auto-crud 1.11.0 → 1.11.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 CHANGED
@@ -673,10 +673,45 @@ table={{
673
673
 
674
674
  ## 🔧 工具栏操作配置
675
675
 
676
- `toolbar` 数组控制页面顶部右侧工具栏的按钮,设计思路完全对齐行操作 `actions`。旧 prop `toolbarActions` 仍兼容读取,但新代码请使用 `toolbar`。
676
+ ### 排序与列设置的语言
677
+
678
+ `AutoCrudTable` 的 `locale` 同时控制刷新、排序和列设置。支持 `zh-CN`(默认)、`en-US`、`ja-JP`、`ko-KR`、`fr-FR`、`de-DE`、`es-ES`。排序与列设置的按钮提示、弹层、字段搜索、排序方向、空状态及排序拖动的无障碍说明和播报均随语言切换。
679
+
680
+ ```tsx
681
+ <AutoCrudTable schema={schema} resource={resource} locale="en-US" />
682
+
683
+ <AutoCrudTable
684
+ schema={schema}
685
+ resource={resource}
686
+ locale={{
687
+ tableControls: {
688
+ sort: { label: '排序规则' },
689
+ columns: { label: '显示列' },
690
+ },
691
+ }}
692
+ />
693
+ ```
694
+
695
+ 对象形式按现有规则与中文语言包深合并;未覆盖的词条保留中文。`tableControls` 在 `AutoCrudLocale` 中为可选字段,已有自定义语言包无需补全字段。
696
+
697
+ 独立使用 `AutoTable` 或 `DataTableViewOptions` 时,排序和列设置保留原有英文默认值,可分别传入 `resolveLocale('ja-JP').tableControls` 或其 `columns` 词条组。业务字段和列名仍由调用方的 `fields` / 列配置提供。
698
+
699
+ `toolbar` 数组控制工具栏操作,设计思路完全对齐行操作 `actions`。旧 prop `toolbarActions` 仍兼容读取,但新代码请使用 `toolbar`。
677
700
 
678
701
  内置操作类型:`refresh`(刷新)、`create`(新建)、`import`(导入)、`export`(导出)。
679
702
 
703
+ 刷新固定显示在搜索筛选行右侧,顺序为 `[排序] [刷新] [列设置]`;其 `label`、`onClick`、`component` 和隐藏配置仍由 `toolbar` 控制。其余操作保留在上方工具栏,没有可见操作时不占空行。
704
+
705
+ 直接使用 `AutoTable` 时,可通过 `toolbarExtra` 插入排序与列设置之间的控件:
706
+
707
+ ```tsx
708
+ <AutoTable
709
+ schema={schema}
710
+ data={rows}
711
+ toolbarExtra={<Button onClick={refresh}>刷新</Button>}
712
+ />
713
+ ```
714
+
680
715
  ### 只添加自定义按钮(内置保持默认)
681
716
 
682
717
  只传 `type: "custom"` 项时,所有内置按钮(刷新、导入、导出、新建)保持原样,custom 项按 `position` 插入首部或尾部。
@@ -692,12 +727,13 @@ table={{
692
727
  { type: 'custom', component: <Button variant="outline">批量标签</Button> }, // 默认 position: "end"
693
728
  ]}
694
729
  />
695
- // 渲染顺序: 分类管理 · [刷新] · [导入] · [导出] · [新建] · 批量标签
730
+ // 上方工具栏: 分类管理 · [导入] · [导出] · [新建] · 批量标签
731
+ // 搜索筛选行右侧: [排序] · [刷新] · [列设置]
696
732
  ```
697
733
 
698
734
  ### 调整内置按钮顺序
699
735
 
700
- 数组中只要包含任意内置 `type`,就会**完全接管工具栏** —— 未列出的内置按钮**直接隐藏**,渲染顺序**严格按数组**。
736
+ 数组中只要包含任意内置 `type`,就会**完全接管工具栏** —— 未列出的内置按钮**直接隐藏**。刷新保持在搜索筛选行,其他按钮的渲染顺序**严格按数组**。
701
737
 
702
738
  ```tsx
703
739
  <AutoCrudTable