@agile-team/mach-table-react 0.30.1 → 0.31.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 +20 -1
- package/dist/mach-table.css +1 -2306
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# @agile-team/mach-table-react
|
|
6
6
|
|
|
7
|
-
MachTable 0.
|
|
7
|
+
MachTable 0.31.0 的官方 React 18+ 适配包。一个依赖即可获得 Core、泛型 `<MachTable>`、应用/路由配置、按需工作流、StrictMode 安全清理和最新闭包事件处理。
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
pnpm add @agile-team/mach-table-react
|
|
@@ -113,6 +113,25 @@ const query = useMachTableQuery({
|
|
|
113
113
|
|
|
114
114
|
该包自动依赖 `@agile-team/mach-table` 并重导出 Core 类型;宿主只需提供 `react` 和 `react-dom >= 18`。
|
|
115
115
|
|
|
116
|
+
## 行拖拽与条件整行颜色
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import { dragColumn, type GridOptions } from "@agile-team/mach-table-react";
|
|
120
|
+
|
|
121
|
+
interface Plan { id: string; name: string; status: string }
|
|
122
|
+
const options: GridOptions<Plan> = {
|
|
123
|
+
rowKey: "id",
|
|
124
|
+
columnDefs: [dragColumn(), { field: "name" }, { field: "status" }],
|
|
125
|
+
rowStyleRules: [
|
|
126
|
+
{ when: ({ data }) => data.status === "pending", tone: "warning" },
|
|
127
|
+
{ when: ({ data }) => data.status === "failed", tone: "danger" },
|
|
128
|
+
{ when: ({ data }) => data.status === "done", tone: "success" }
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
状态码由应用定义,包内不识别业务状态。颜色规则取第一条命中结果,未命中时沿用默认样式;支持自定义背景/文字颜色、固定列、明暗主题、选择和虚拟行复用。拖拽提供主题手柄、落点线、位置浮层、边缘滚动、Esc 取消和 Alt + ↑/↓ 移动。扁平外部数据设置 `applyRowDrag: false`,由 `onRowDragEnd` 处理持久化;自动模式先完成移动再发出事件,使用 `targetIndex` 读取最终下标。树、分组及排序等自动模式限制见[完整配方](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/row-presentation.md)。
|
|
134
|
+
|
|
116
135
|
文档:[React 指南](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/react.md) · [企业接入](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/enterprise-integration.md) · [SSR](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/ssr.md)
|
|
117
136
|
|
|
118
137
|
Source-available © ChenyCHENYU (Agile Team). 任何使用均须事先取得书面授权。详见 [LICENSE](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSE) 与[授权流程](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSING.md)。
|