@canvas-components/react-list-table 0.3.43 → 0.3.45

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
@@ -214,6 +214,42 @@ pnpm add @canvas-components/react-list-table @canvas-components/list-table react
214
214
 
215
215
  ## 使用方法
216
216
 
217
+ 打印配置可以通过 `printPresets` 预设交给 `ReactListTable`。每个预设有一个用于选择的名称和打印配置;未提供的字段使用默认值。没有已保存配置时默认使用第一个预设,也可以在打印配置弹窗中切换;启用本地缓存后,后续打开优先恢复所选预设和本地修改。
218
+
219
+ ```tsx
220
+ import {
221
+ ReactListTable,
222
+ type ReactListTablePrintPreset,
223
+ } from "@canvas-components/react-list-table";
224
+
225
+ const printPresets: ReactListTablePrintPreset[] = [
226
+ {
227
+ name: "横向明细",
228
+ config: {
229
+ title: "明细清单",
230
+ paperSize: "a4",
231
+ orientation: "landscape",
232
+ rowsPerPage: 24,
233
+ pageMargins: { top: 10, right: 10, bottom: 10, left: 10 },
234
+ columns: [
235
+ { key: "name", width: 60, align: "left" },
236
+ { key: "amount", width: 35, align: "right" },
237
+ ],
238
+ selectedKeys: ["name", "amount"],
239
+ },
240
+ },
241
+ ];
242
+
243
+ <ReactListTable
244
+ storageKey="invoice-list"
245
+ printPresets={printPresets}
246
+ columns={columns}
247
+ dataSource={data}
248
+ />;
249
+ ```
250
+
251
+ 配置名称显示在打印配置弹窗顶部。列通过 `key` 对应表格列;列宽单位为毫米。需要缓存预设选择和用户调整时提供 `storageKey` 并保持弹窗中的本地缓存选项开启。
252
+
217
253
  ```tsx
218
254
  import { useMemo, useRef } from "react";
219
255
  import {