@wordrhyme/auto-crud 1.5.7 → 1.6.0
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 +37 -0
- package/dist/index.cjs +329 -186
- package/dist/index.d.cts +19 -5
- package/dist/index.d.ts +19 -5
- package/dist/index.js +329 -186
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1044,6 +1044,12 @@ setDateFormatter(undefined);
|
|
|
1044
1044
|
|
|
1045
1045
|
`setDateFormatter` 是进程/运行时级配置,建议在应用启动时注册一个稳定的 formatter。多个注册可以重叠,清理函数只移除对应注册,允许乱序清理。SSR 场景不要在每个请求中重复调用 setter;如需按请求选择语言或时区,应由稳定 formatter 通过宿主提供的并发安全上下文读取当前请求策略。
|
|
1046
1046
|
|
|
1047
|
+
原有 `setDateFormatter(formatter)` 调用保持兼容:筛选器的已选日期标签继续使用宿主 formatter,包括其自定义格式和时区行为。
|
|
1048
|
+
|
|
1049
|
+
日期筛选日历可通过 `setDateFormatter(formatter, { locale, timeZone })` 接收宿主配置(`DateLocaleOptions`)。语言或时区改变时重新注册并清理旧注册,已挂载的筛选器会同步更新月份、星期和日期标签。筛选值使用 `YYYY-MM-DD` 日历日字符串;服务端配置 `resolveDateRange` 时按宿主查询时区解析边界,否则使用服务端本地时区,并继续兼容时间戳输入。显式传入日历配置后,日期标签使用指定 locale,直接格式化日历日,不再调用 formatter 或进行时间点的时区转换。`timeZone` 仅随注册保存宿主策略,不会改变日历的“今天”、默认月份或自动配置服务端查询时区;业务时区边界仍须由服务端 `resolveDateRange` 提供。
|
|
1050
|
+
|
|
1051
|
+
升级时请同时更新 `@wordrhyme/auto-crud` 与 `@wordrhyme/auto-crud-server`:新日历提交 `YYYY-MM-DD`,旧服务端默认解析器无法识别。自定义 `resolveDateRange` 也应接受此格式;已有时间戳 URL 仍可读取。
|
|
1052
|
+
|
|
1047
1053
|
### Schema Bridge - 核心转换函数
|
|
1048
1054
|
|
|
1049
1055
|
```typescript
|
|
@@ -1454,3 +1460,34 @@ MIT © [wordrhyme](https://github.com/pixpilot/shadcn-components)
|
|
|
1454
1460
|
- [Shadcn UI](https://ui.shadcn.com/) - 优雅的 UI 组件
|
|
1455
1461
|
- [Notion](https://notion.so) - 高级筛选器设计
|
|
1456
1462
|
- [Linear](https://linear.app) - 命令面板设计
|
|
1463
|
+
|
|
1464
|
+
### Detail presentation
|
|
1465
|
+
|
|
1466
|
+
Details automatically share field labels, `enum`/`dataSource` mappings and
|
|
1467
|
+
`fields[field].table` presentation settings (`label`, `display`, `options`,
|
|
1468
|
+
`dataSource`) with the list. No presentation switch is required. Default details
|
|
1469
|
+
show full text and all array items, preserving localized boolean labels.
|
|
1470
|
+
Table-only hidden fields remain available in details; shared `hidden` and
|
|
1471
|
+
`permissions.deny` always take precedence. Labels are resolved from the selected
|
|
1472
|
+
record, including when it is absent from the current list page.
|
|
1473
|
+
|
|
1474
|
+
```tsx
|
|
1475
|
+
<AutoCrudTable
|
|
1476
|
+
schema={schema}
|
|
1477
|
+
resource={resource}
|
|
1478
|
+
fields={{ description: { table: { hidden: true } } }}
|
|
1479
|
+
view={{
|
|
1480
|
+
overrides: {
|
|
1481
|
+
description: { label: 'Full description', index: 0 },
|
|
1482
|
+
region: { cell: ({ getValue }) => <strong>{String(getValue())}</strong> },
|
|
1483
|
+
},
|
|
1484
|
+
}}
|
|
1485
|
+
/>
|
|
1486
|
+
```
|
|
1487
|
+
|
|
1488
|
+
`view.overrides` changes details only. Custom list `cell` callbacks are not inherited
|
|
1489
|
+
by default because they can contain list actions or depend on table state. To
|
|
1490
|
+
explicitly reuse them, set `view.presentation: 'table'`; detail overrides still win.
|
|
1491
|
+
This provides a real **separate single-row** TanStack context, not the original
|
|
1492
|
+
list's pagination, selection or row index. Reused custom cells retain their own
|
|
1493
|
+
truncation and interaction behavior.
|