@canvas-components/react-list-table 0.3.74 → 0.3.76

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
@@ -1408,7 +1408,27 @@ function ReactTableContextMenuView(props) {
1408
1408
  onChange: request.onChangeDensity
1409
1409
  }
1410
1410
  ),
1411
+ request.onOpenPaginationConfig ? /* @__PURE__ */ jsxRuntime.jsx(
1412
+ MenuAction,
1413
+ {
1414
+ label: "\u5206\u9875\u914D\u7F6E",
1415
+ onClick: () => {
1416
+ request.onClose();
1417
+ request.onOpenPaginationConfig?.();
1418
+ }
1419
+ }
1420
+ ) : null,
1411
1421
  /* @__PURE__ */ jsxRuntime.jsx(ZoomMenu, { value: request.zoom ?? 1, onChange: request.onChangeZoom }),
1422
+ request.onToggleDebug ? /* @__PURE__ */ jsxRuntime.jsx(
1423
+ MenuAction,
1424
+ {
1425
+ label: request.debugEnabled ? "\u5173\u95ED\u8C03\u8BD5" : "\u5F00\u542F\u8C03\u8BD5",
1426
+ onClick: () => {
1427
+ request.onClose();
1428
+ request.onToggleDebug?.();
1429
+ }
1430
+ }
1431
+ ) : null,
1412
1432
  request.columnSettingsCacheAvailable === true ? /* @__PURE__ */ jsxRuntime.jsx(
1413
1433
  MenuSubmenu,
1414
1434
  {
@@ -4443,6 +4463,7 @@ function getEditorInputStyle(request) {
4443
4463
  color: request.theme.cellColor ?? request.theme.textColor,
4444
4464
  textAlign: request.theme.textAlign,
4445
4465
  fontFamily: request.theme.fontFamily,
4466
+ fontWeight: request.theme.fontWeight ?? "normal",
4446
4467
  fontSize,
4447
4468
  // 用像素 token,确保 select/time/color 触发器与内部 Input 同步缩放。
4448
4469
  ["--canvas-react-control-height"]: `${height}px`,
@@ -4472,6 +4493,8 @@ function resolveEditorOverlayStyle(params) {
4472
4493
  minHeight: height,
4473
4494
  zIndex: 1200,
4474
4495
  boxSizing: "border-box",
4496
+ fontFamily: params.fontFamily,
4497
+ fontWeight: params.fontWeight ?? "normal",
4475
4498
  // 覆盖表单组件 token,使输入框高度/字号/内边距跟随表格缩放。
4476
4499
  ["--canvas-react-control-height"]: `${height}px`,
4477
4500
  ["--canvas-react-control-padding-inline"]: `${Math.max(resolvedPaddingInline - 1, 0)}px`,
@@ -4896,6 +4919,7 @@ function CompositeEditor({
4896
4919
  style: {
4897
4920
  fontSize: request.theme.fontSize,
4898
4921
  fontFamily: request.theme.fontFamily,
4922
+ fontWeight: request.theme.fontWeight ?? "normal",
4899
4923
  color: request.theme.textColor,
4900
4924
  ...errorStyle
4901
4925
  },
@@ -5356,6 +5380,8 @@ function ReactTableEditorOverlay(props) {
5356
5380
  rect: request.rect,
5357
5381
  hostRect: request.hostRect,
5358
5382
  fontSize: request.theme.fontSize,
5383
+ fontFamily: request.theme.fontFamily,
5384
+ fontWeight: request.theme.fontWeight,
5359
5385
  paddingInline: request.theme.paddingInline,
5360
5386
  paddingBlock: request.theme.paddingBlock,
5361
5387
  contentZoom: request.theme.contentZoom
@@ -6362,7 +6388,12 @@ function ReactTableFilterPanelView(props) {
6362
6388
  }
6363
6389
 
6364
6390
  // src/components/react-list-table-layout.ts
6365
- function resolveReactListTablePaginationLayout(density) {
6391
+ function resolveReactListTablePaginationLayout(density, size) {
6392
+ if (size && size !== "auto") {
6393
+ return resolveReactListTablePaginationLayout(
6394
+ size === "small" ? 26 : size === "large" ? 48 : 32
6395
+ );
6396
+ }
6366
6397
  if (typeof density === "number" && density <= 26) {
6367
6398
  return { size: "small", height: 32, paddingTop: 8 };
6368
6399
  }
@@ -6387,7 +6418,7 @@ function ReactTablePaginationView(props) {
6387
6418
  if (!config) {
6388
6419
  return null;
6389
6420
  }
6390
- const layout = resolveReactListTablePaginationLayout(density);
6421
+ const layout = resolveReactListTablePaginationLayout(density, config.size);
6391
6422
  return /* @__PURE__ */ jsxRuntime.jsx(
6392
6423
  "div",
6393
6424
  {
@@ -6406,6 +6437,7 @@ function ReactTablePaginationView(props) {
6406
6437
  {
6407
6438
  styles: config.styles,
6408
6439
  size: layout.size,
6440
+ pageInfoText: config.pageInfoText,
6409
6441
  current: config.current,
6410
6442
  total: config.total,
6411
6443
  pageSize: config.pageSize,
@@ -6430,6 +6462,402 @@ function ReactTablePaginationView(props) {
6430
6462
  }
6431
6463
  );
6432
6464
  }
6465
+ var pageInfoFormats = [
6466
+ { value: "", label: "\u4E0D\u989D\u5916\u663E\u793A" },
6467
+ {
6468
+ value: "\u7B2C {current} \u9875 / \u5171 {totalPages} \u9875",
6469
+ label: "\u7B2C 1 \u9875 / \u5171 10 \u9875"
6470
+ },
6471
+ { value: "{current} / {totalPages}", label: "1 / 10" },
6472
+ { value: "custom", label: "\u81EA\u5B9A\u4E49\u683C\u5F0F" }
6473
+ ];
6474
+ var totalFormats = [
6475
+ { value: "inherit", label: "\u6CBF\u7528\u4F20\u5165\u683C\u5F0F" },
6476
+ { value: "\u5171 {total} \u6761", label: "\u5171 200 \u6761" },
6477
+ {
6478
+ value: "\u7B2C {start}\u2013{end} \u6761\uFF0C\u5171 {total} \u6761",
6479
+ label: "\u7B2C 1\u201320 \u6761\uFF0C\u5171 200 \u6761"
6480
+ },
6481
+ { value: "hide", label: "\u9690\u85CF" },
6482
+ { value: "custom", label: "\u81EA\u5B9A\u4E49\u683C\u5F0F" }
6483
+ ];
6484
+ function createPaginationDraft(snapshot, incoming = false) {
6485
+ const source = incoming ? snapshot.incoming : snapshot.value;
6486
+ const config = listTable.withPaginationDefaults(
6487
+ source || (incoming ? {} : snapshot.retained)
6488
+ );
6489
+ const pageTemplate = config.pageInfoFormat ?? "";
6490
+ const totalTemplate = typeof config.totalFormat === "string" ? config.totalFormat : "";
6491
+ return {
6492
+ cacheEnabled: snapshot.cache?.enabled ?? false,
6493
+ cacheScope: snapshot.cache?.scope ?? "all",
6494
+ enabled: !!source,
6495
+ config,
6496
+ current: String(config.current),
6497
+ pageSize: String(config.pageSize),
6498
+ minPageSize: String(config.minPageSize ?? 1),
6499
+ maxPageSize: config.maxPageSize == null ? "" : String(config.maxPageSize),
6500
+ candidates: config.pageSizeOptions.join(", "),
6501
+ pageChoice: pageInfoFormats.some((o) => o.value === pageTemplate) ? pageTemplate : "custom",
6502
+ totalChoice: config.totalFormat === false ? "hide" : config.totalFormat === void 0 ? "inherit" : totalFormats.some((o) => o.value === totalTemplate) ? totalTemplate : "custom",
6503
+ pageTemplate,
6504
+ totalTemplate
6505
+ };
6506
+ }
6507
+ function paginationDraftValue(draft) {
6508
+ if (!draft.enabled) return false;
6509
+ return {
6510
+ ...draft.config,
6511
+ current: Number(draft.current),
6512
+ pageSize: Number(draft.pageSize),
6513
+ minPageSize: Number(draft.minPageSize),
6514
+ maxPageSize: draft.maxPageSize.trim() ? Number(draft.maxPageSize) : void 0,
6515
+ pageSizeOptions: [
6516
+ ...new Set(draft.candidates.split(/[,,]/).map((n) => Number(n.trim())))
6517
+ ].sort((a, b) => a - b),
6518
+ pageInfoFormat: draft.pageChoice === "custom" ? draft.pageTemplate : draft.pageChoice || void 0,
6519
+ totalFormat: draft.totalChoice === "inherit" ? void 0 : draft.totalChoice === "hide" ? false : draft.totalChoice === "custom" ? draft.totalTemplate : draft.totalChoice
6520
+ };
6521
+ }
6522
+
6523
+ // src/features/pagination/pagination-config-dialog.css
6524
+ styleInject(".react-list-table-pagination-config {\n display: grid;\n gap: 18px;\n color: var(--canvas-react-color-text, #253247);\n}\n.react-list-table-pagination-config-enable {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 16px;\n}\n.react-list-table-pagination-config-cache {\n flex-wrap: wrap;\n}\n.react-list-table-pagination-config-cache > label {\n flex-shrink: 0;\n white-space: nowrap;\n}\n.react-list-table-pagination-config-cache-scope {\n flex: 0 1 180px;\n min-width: 120px;\n}\n.react-list-table-pagination-config-help {\n color: var(--canvas-react-color-text-muted, #64748b);\n font-size: 12px;\n margin-top: 6px;\n}\n.react-list-table-pagination-config fieldset {\n border: 0;\n padding: 0;\n margin: 0;\n min-width: 0;\n}\n.react-list-table-pagination-config fieldset:disabled {\n opacity: 0.5;\n}\n.react-list-table-pagination-config h3 {\n font-size: 13px;\n margin: 18px 0 12px;\n}\n.react-list-table-pagination-config h3:first-child {\n margin-top: 0;\n}\n.react-list-table-pagination-config-grid {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 14px 20px;\n margin-top: 12px;\n}\n.react-list-table-pagination-config-field {\n display: grid;\n align-content: start;\n gap: 6px;\n min-width: 0;\n font-size: 13px;\n}\n.react-list-table-pagination-config-check {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n}\n.react-list-table-pagination-config-check input {\n accent-color: var(--canvas-react-color-primary, #2563eb);\n}\n.react-list-table-pagination-config details {\n margin-top: 18px;\n border-top: 1px solid var(--canvas-react-color-border, #e2e8f0);\n padding-top: 14px;\n}\n.react-list-table-pagination-config summary {\n cursor: pointer;\n font-size: 13px;\n font-weight: 600;\n}\n.react-list-table-pagination-config-preview {\n border-top: 1px solid var(--canvas-react-color-border, #e2e8f0);\n padding-top: 10px;\n min-width: 0;\n}\n.react-list-table-pagination-config-pager {\n display: flex;\n justify-content: flex-end;\n margin-top: 12px;\n}\n.react-list-table-pagination-config-pager > div {\n flex-wrap: wrap;\n justify-content: flex-end;\n}\n.react-list-table-pagination-config-off {\n text-align: center;\n padding: 16px 0;\n color: var(--canvas-react-color-text-muted, #64748b);\n}\n.react-list-table-pagination-config-error {\n color: var(--canvas-react-color-danger, #dc2626);\n font-size: 12px;\n}\n.react-list-table-pagination-config-footer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n flex-wrap: wrap;\n width: 100%;\n}\n.react-list-table-pagination-config-footer > div {\n display: flex;\n gap: 10px;\n margin-left: auto;\n}\n@media (max-width: 460px) {\n .react-list-table-pagination-config-grid {\n grid-template-columns: minmax(0, 1fr);\n }\n}\n");
6525
+ function ReactListTablePaginationConfigDialog(props) {
6526
+ const [initial] = react.useState(() => createPaginationDraft(props.snapshot));
6527
+ const [draft, setDraft] = react.useState(initial);
6528
+ const [currentEdited, setCurrentEdited] = react.useState(false);
6529
+ const [errors, setErrors] = react.useState({});
6530
+ const patch = (next) => setDraft((current2) => ({ ...current2, ...next }));
6531
+ const patchConfig = (next) => setDraft((current2) => ({
6532
+ ...current2,
6533
+ config: { ...current2.config, ...next }
6534
+ }));
6535
+ const value = paginationDraftValue(draft);
6536
+ const scroll = draft.config.mode === "scroll";
6537
+ const pageSize = Math.max(
6538
+ 1,
6539
+ Number.isSafeInteger(Number(draft.pageSize)) ? Number(draft.pageSize) : 10
6540
+ );
6541
+ const totalPages = Math.max(1, Math.ceil(props.snapshot.total / pageSize));
6542
+ const current = Math.min(totalPages, Math.max(1, Number(draft.current) || 1));
6543
+ const field = (label, key, control) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-field", children: [
6544
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
6545
+ control,
6546
+ errors[key] ? /* @__PURE__ */ jsxRuntime.jsx("span", { role: "alert", className: "react-list-table-pagination-config-error", children: errors[key] }) : null
6547
+ ] });
6548
+ const input = (label, key) => field(
6549
+ label,
6550
+ key === "candidates" ? "pageSizeOptions" : key,
6551
+ /* @__PURE__ */ jsxRuntime.jsx(
6552
+ reactComponents.ReactInput,
6553
+ {
6554
+ "aria-label": label,
6555
+ value: draft[key],
6556
+ inputMode: key === "candidates" ? "text" : "numeric",
6557
+ allowClear: false,
6558
+ placeholder: key === "maxPageSize" ? "\u4E0D\u9650\u5236" : void 0,
6559
+ onChange: (event) => {
6560
+ if (key === "current") setCurrentEdited(true);
6561
+ patch({
6562
+ [key]: event.target.value,
6563
+ ...key === "pageSize" && !currentEdited ? { current: "1" } : {}
6564
+ });
6565
+ }
6566
+ }
6567
+ )
6568
+ );
6569
+ const check = (label, key, disabled = false) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "react-list-table-pagination-config-check", children: [
6570
+ /* @__PURE__ */ jsxRuntime.jsx(
6571
+ "input",
6572
+ {
6573
+ type: "checkbox",
6574
+ checked: key === "allowPageSizeInput" ? draft.config.allowPageSizeInput ?? !!draft.config.showSizeChanger : !!draft.config[key],
6575
+ disabled,
6576
+ onChange: (event) => patchConfig({ [key]: event.target.checked })
6577
+ }
6578
+ ),
6579
+ label
6580
+ ] });
6581
+ const confirm = () => {
6582
+ if (JSON.stringify(draft) === JSON.stringify(initial)) {
6583
+ props.onClose();
6584
+ return;
6585
+ }
6586
+ const nextErrors = {
6587
+ ...listTable.validatePaginationConfig(value, props.snapshot.total)
6588
+ };
6589
+ if (draft.enabled && draft.pageChoice === "custom" && !draft.pageTemplate.trim())
6590
+ nextErrors.pageInfoFormat = "\u8BF7\u8F93\u5165\u9875\u7801\u4FE1\u606F\u683C\u5F0F";
6591
+ setErrors(nextErrors);
6592
+ if (Object.keys(nextErrors).length) return;
6593
+ const result = props.onConfirm(value, {
6594
+ enabled: draft.cacheEnabled,
6595
+ scope: draft.cacheScope
6596
+ });
6597
+ if (result.ok) props.onClose();
6598
+ else setErrors(result.errors);
6599
+ };
6600
+ const totalFormat = value && value.totalFormat;
6601
+ const pageFormat = value && value.pageInfoFormat;
6602
+ return /* @__PURE__ */ jsxRuntime.jsx(
6603
+ reactComponents.ReactModal,
6604
+ {
6605
+ open: true,
6606
+ title: "\u5206\u9875\u914D\u7F6E",
6607
+ width: 640,
6608
+ fullscreenable: false,
6609
+ onCancel: props.onClose,
6610
+ footer: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-footer", children: [
6611
+ /* @__PURE__ */ jsxRuntime.jsx(
6612
+ reactComponents.ReactButton,
6613
+ {
6614
+ type: "text",
6615
+ onClick: () => {
6616
+ setDraft(createPaginationDraft(props.snapshot, true));
6617
+ setCurrentEdited(false);
6618
+ setErrors({});
6619
+ },
6620
+ children: "\u6062\u590D\u4F20\u5165\u914D\u7F6E"
6621
+ }
6622
+ ),
6623
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6624
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactButton, { onClick: props.onClose, children: "\u53D6\u6D88" }),
6625
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactButton, { type: "primary", onClick: confirm, children: "\u786E\u5B9A" })
6626
+ ] })
6627
+ ] }),
6628
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config", children: [
6629
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-enable", children: [
6630
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6631
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "\u542F\u7528\u5206\u9875" }),
6632
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-help", children: "\u5173\u95ED\u540E\u5C55\u793A\u5168\u90E8\u5DF2\u52A0\u8F7D\u6570\u636E\uFF0C\u4E0D\u663E\u793A\u5206\u9875\u63A7\u4EF6" })
6633
+ ] }),
6634
+ /* @__PURE__ */ jsxRuntime.jsx(
6635
+ reactComponents.ReactSwitch,
6636
+ {
6637
+ "aria-label": "\u542F\u7528\u5206\u9875",
6638
+ checked: draft.enabled,
6639
+ onChange: (enabled) => {
6640
+ setCurrentEdited(false);
6641
+ patch({ enabled, ...enabled ? { current: "1" } : {} });
6642
+ }
6643
+ }
6644
+ )
6645
+ ] }),
6646
+ /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { disabled: !draft.enabled, children: [
6647
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { children: scroll ? "\u6EDA\u52A8\u52A0\u8F7D" : "\u57FA\u672C\u8BBE\u7F6E" }),
6648
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6649
+ scroll ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6650
+ "\u5F53\u524D\u5DF2\u52A0\u8F7D ",
6651
+ draft.current,
6652
+ " \u9875"
6653
+ ] }) : input("\u5F53\u524D\u9875", "current"),
6654
+ input(scroll ? "\u6BCF\u6279\u6761\u6570" : "\u6BCF\u9875\u6761\u6570", "pageSize")
6655
+ ] }),
6656
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-help", children: [
6657
+ "\u5171 ",
6658
+ props.snapshot.total,
6659
+ " \u6761\u6570\u636E \xB7 ",
6660
+ totalPages,
6661
+ " \u9875"
6662
+ ] }),
6663
+ !scroll ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6664
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "\u663E\u793A\u8BBE\u7F6E" }),
6665
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-grid", children: field(
6666
+ "\u5206\u9875\u5C3A\u5BF8",
6667
+ "size",
6668
+ /* @__PURE__ */ jsxRuntime.jsx(
6669
+ reactComponents.ReactSelect,
6670
+ {
6671
+ "aria-label": "\u5206\u9875\u5C3A\u5BF8",
6672
+ value: draft.config.size ?? "auto",
6673
+ options: [
6674
+ { value: "auto", label: "\u8DDF\u968F\u8868\u683C" },
6675
+ { value: "small", label: "\u5C0F" },
6676
+ { value: "middle", label: "\u4E2D" },
6677
+ { value: "large", label: "\u5927" }
6678
+ ],
6679
+ onChange: (size) => patchConfig({
6680
+ size
6681
+ })
6682
+ }
6683
+ )
6684
+ ) }),
6685
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6686
+ check("\u7B80\u6D01\u6A21\u5F0F", "simple"),
6687
+ check("\u7D27\u51D1\u9875\u7801", "showLessItems", !!draft.config.simple),
6688
+ check("\u663E\u793A\u6BCF\u9875\u6761\u6570\u9009\u62E9\u5668", "showSizeChanger"),
6689
+ check("\u663E\u793A\u5FEB\u901F\u8DF3\u9875", "showQuickJumper")
6690
+ ] }),
6691
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "\u6587\u6848\u8BBE\u7F6E" }),
6692
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6693
+ field(
6694
+ "\u9875\u7801\u4FE1\u606F\u683C\u5F0F",
6695
+ "pageInfoFormat",
6696
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6697
+ /* @__PURE__ */ jsxRuntime.jsx(
6698
+ reactComponents.ReactSelect,
6699
+ {
6700
+ "aria-label": "\u9875\u7801\u4FE1\u606F\u683C\u5F0F",
6701
+ value: draft.pageChoice,
6702
+ options: pageInfoFormats,
6703
+ onChange: (pageChoice) => patch({ pageChoice })
6704
+ }
6705
+ ),
6706
+ draft.pageChoice === "custom" ? /* @__PURE__ */ jsxRuntime.jsx(
6707
+ reactComponents.ReactInput,
6708
+ {
6709
+ "aria-label": "\u81EA\u5B9A\u4E49\u9875\u7801\u4FE1\u606F\u683C\u5F0F",
6710
+ maxLength: 500,
6711
+ placeholder: "\u7B2C {current} \u9875 / \u5171 {totalPages} \u9875",
6712
+ value: draft.pageTemplate,
6713
+ onChange: (event) => patch({ pageTemplate: event.target.value })
6714
+ }
6715
+ ) : null
6716
+ ] })
6717
+ ),
6718
+ field(
6719
+ "\u603B\u6761\u6570\u683C\u5F0F",
6720
+ "totalFormat",
6721
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6722
+ /* @__PURE__ */ jsxRuntime.jsx(
6723
+ reactComponents.ReactSelect,
6724
+ {
6725
+ "aria-label": "\u603B\u6761\u6570\u683C\u5F0F",
6726
+ value: draft.totalChoice,
6727
+ options: totalFormats,
6728
+ onChange: (totalChoice) => patch({ totalChoice })
6729
+ }
6730
+ ),
6731
+ draft.totalChoice === "custom" ? /* @__PURE__ */ jsxRuntime.jsx(
6732
+ reactComponents.ReactInput,
6733
+ {
6734
+ "aria-label": "\u81EA\u5B9A\u4E49\u603B\u6761\u6570\u683C\u5F0F",
6735
+ maxLength: 500,
6736
+ placeholder: "\u7B2C {start}\u2013{end} \u6761\uFF0C\u5171 {total} \u6761",
6737
+ value: draft.totalTemplate,
6738
+ onChange: (event) => patch({ totalTemplate: event.target.value })
6739
+ }
6740
+ ) : null
6741
+ ] })
6742
+ )
6743
+ ] }),
6744
+ draft.pageChoice === "custom" || draft.totalChoice === "custom" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-help", children: [
6745
+ "\u9875\u7801\uFF1A",
6746
+ "{current}\u3001{totalPages}",
6747
+ "\uFF1B\u603B\u6761\u6570\uFF1A",
6748
+ "{total}\u3001{start}\u3001{end}"
6749
+ ] }) : null,
6750
+ /* @__PURE__ */ jsxRuntime.jsxs("details", { children: [
6751
+ /* @__PURE__ */ jsxRuntime.jsx("summary", { children: "\u9AD8\u7EA7\u8BBE\u7F6E" }),
6752
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6753
+ input("\u6BCF\u9875\u6761\u6570\u5019\u9009", "candidates"),
6754
+ input("\u6700\u5C0F\u6BCF\u9875\u6761\u6570", "minPageSize"),
6755
+ input("\u6700\u5927\u6BCF\u9875\u6761\u6570", "maxPageSize")
6756
+ ] }),
6757
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6758
+ check(
6759
+ "\u5141\u8BB8\u624B\u8F93\u6BCF\u9875\u6761\u6570",
6760
+ "allowPageSizeInput",
6761
+ !draft.config.showSizeChanger
6762
+ ),
6763
+ check("\u7981\u7528\u5206\u9875\u64CD\u4F5C", "disabled")
6764
+ ] })
6765
+ ] })
6766
+ ] }) : null
6767
+ ] }),
6768
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6769
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-enable react-list-table-pagination-config-cache", children: [
6770
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "react-list-table-pagination-config-check", children: [
6771
+ /* @__PURE__ */ jsxRuntime.jsx(
6772
+ "input",
6773
+ {
6774
+ type: "checkbox",
6775
+ "aria-label": "\u7F13\u5B58\u5230\u672C\u5730",
6776
+ checked: draft.cacheEnabled,
6777
+ onChange: (event) => patch({ cacheEnabled: event.target.checked })
6778
+ }
6779
+ ),
6780
+ "\u7F13\u5B58\u5230\u672C\u5730"
6781
+ ] }),
6782
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-cache-scope", children: /* @__PURE__ */ jsxRuntime.jsx(
6783
+ reactComponents.ReactSelect,
6784
+ {
6785
+ "aria-label": "\u7F13\u5B58\u8303\u56F4",
6786
+ disabled: !draft.cacheEnabled,
6787
+ value: draft.cacheScope,
6788
+ options: [
6789
+ {
6790
+ value: "table",
6791
+ label: "\u5F53\u524D\u8868\u683C",
6792
+ disabled: !props.snapshot.cache?.currentTableAvailable
6793
+ },
6794
+ { value: "all", label: "\u6240\u6709\u8868\u683C" }
6795
+ ],
6796
+ onChange: (scope) => patch({ cacheScope: scope })
6797
+ }
6798
+ ) })
6799
+ ] }),
6800
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-help", children: [
6801
+ draft.cacheScope === "all" ? "\u4F5C\u4E3A\u6240\u6709\u8868\u683C\u7684\u5171\u4EAB\u9ED8\u8BA4\u914D\u7F6E\uFF1B\u660E\u786E\u8BBE\u7F6E pagination=false \u7684\u8868\u683C\u4E0D\u4F7F\u7528\u5171\u4EAB\u7F13\u5B58\u3002\u5355\u8868\u7F13\u5B58\u4F18\u5148\u3002" : "\u4EC5\u4FDD\u5B58\u5230\u5F53\u524D\u8868\u683C\uFF1B\u9700\u8981\u7A33\u5B9A\u7684 storageKey\u3002",
6802
+ " ",
6803
+ "\u5F53\u524D\u9875\u4E0D\u7F13\u5B58\u3002"
6804
+ ] }),
6805
+ errors.cache ? /* @__PURE__ */ jsxRuntime.jsx(
6806
+ "div",
6807
+ {
6808
+ role: "alert",
6809
+ className: "react-list-table-pagination-config-error",
6810
+ children: errors.cache
6811
+ }
6812
+ ) : null
6813
+ ] }),
6814
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-preview", children: [
6815
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-help", children: "\u5206\u9875\u9884\u89C8" }),
6816
+ !draft.enabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-off", children: "\u5206\u9875\u5DF2\u5173\u95ED" }) : scroll ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-off", children: "\u6EDA\u52A8\u5230\u5E95\u90E8\u52A0\u8F7D\u4E0B\u4E00\u6279\uFF0C\u4E0D\u663E\u793A\u5206\u9875\u63A7\u4EF6" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-pager", children: /* @__PURE__ */ jsxRuntime.jsx(
6817
+ reactComponents.ReactPagination,
6818
+ {
6819
+ ...draft.config,
6820
+ allowPageSizeInput: draft.config.allowPageSizeInput ?? draft.config.showSizeChanger,
6821
+ size: resolveReactListTablePaginationLayout(
6822
+ void 0,
6823
+ draft.config.size
6824
+ ).size,
6825
+ current,
6826
+ pageSize,
6827
+ total: props.snapshot.total,
6828
+ pageSizeOptions: value ? value.pageSizeOptions : void 0,
6829
+ pageInfoText: pageFormat ? listTable.formatPaginationText(pageFormat, { current, totalPages }) : void 0,
6830
+ showTotal: typeof totalFormat === "string" ? (total, [start, end]) => listTable.formatPaginationText(totalFormat, {
6831
+ total,
6832
+ start: total ? start : 0,
6833
+ end: total ? end : 0
6834
+ }) : totalFormat === false ? void 0 : props.showTotal,
6835
+ onChange: (page) => {
6836
+ setCurrentEdited(true);
6837
+ patch({ current: String(page) });
6838
+ },
6839
+ onPageSizeChange: (_page, size) => patch({
6840
+ pageSize: String(size),
6841
+ ...!currentEdited ? { current: "1" } : {}
6842
+ })
6843
+ }
6844
+ ) })
6845
+ ] }),
6846
+ errors.table ? /* @__PURE__ */ jsxRuntime.jsx("div", { role: "alert", children: errors.table }) : null
6847
+ ] })
6848
+ }
6849
+ );
6850
+ }
6851
+ function usePaginationConfigDialog(request, latest, onClose) {
6852
+ const stale = !!request && !!latest && request.revision !== latest.revision;
6853
+ react.useEffect(() => {
6854
+ if (stale) {
6855
+ onClose();
6856
+ reactComponents.reactMessage.info("\u5206\u9875\u72B6\u6001\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u914D\u7F6E");
6857
+ }
6858
+ }, [stale, onClose]);
6859
+ return request && !stale ? request : null;
6860
+ }
6433
6861
  function ReactTableDangerConfirmView(props) {
6434
6862
  const { request, onClose } = props;
6435
6863
  const confirmingRef = react.useRef(false);
@@ -6845,6 +7273,14 @@ function flattenColumns(columns, parentKey = "root", level = 0, parentHidden = f
6845
7273
  function useReactListTableState(options) {
6846
7274
  const containerRef = react.useRef(null);
6847
7275
  const tableRef = react.useRef(null);
7276
+ const [paginationSnapshot, setPaginationSnapshot] = react.useState(null);
7277
+ const [paginationConfigRequest, setPaginationConfigRequest] = react.useState(null);
7278
+ const hadPaginationConfigRequest = react.useRef(false);
7279
+ react.useEffect(() => {
7280
+ if (hadPaginationConfigRequest.current && !paginationConfigRequest)
7281
+ containerRef.current?.querySelector("canvas")?.focus();
7282
+ hadPaginationConfigRequest.current = !!paginationConfigRequest;
7283
+ }, [paginationConfigRequest]);
6848
7284
  const [editorRequest, setEditorRequest] = react.useState(null);
6849
7285
  const [paginationConfig, setPaginationConfig] = react.useState(null);
6850
7286
  const [tooltipRequest, setTooltipRequest] = react.useState(null);
@@ -6859,6 +7295,15 @@ function useReactListTableState(options) {
6859
7295
  const uiOptions = react.useMemo(
6860
7296
  () => ({
6861
7297
  ...options.ui,
7298
+ onOpenPaginationConfig: () => {
7299
+ const snapshot = tableRef.current?.getPaginationConfig();
7300
+ if (snapshot) setPaginationConfigRequest(snapshot);
7301
+ options.ui?.onOpenPaginationConfig?.();
7302
+ },
7303
+ onPaginationConfigRender: (snapshot) => {
7304
+ setPaginationSnapshot(snapshot);
7305
+ options.ui?.onPaginationConfigRender?.(snapshot);
7306
+ },
6862
7307
  onExportNameRequest: (request) => {
6863
7308
  setExportNameRequest(request);
6864
7309
  options.ui?.onExportNameRequest?.(request);
@@ -6925,6 +7370,8 @@ function useReactListTableState(options) {
6925
7370
  appliedOptionsRef.current = null;
6926
7371
  setEditorRequest(null);
6927
7372
  setPaginationConfig(null);
7373
+ setPaginationSnapshot(null);
7374
+ setPaginationConfigRequest(null);
6928
7375
  setTooltipRequest(null);
6929
7376
  setLoadingRequest(null);
6930
7377
  setFilterPanelRequest(null);
@@ -6949,6 +7396,9 @@ function useReactListTableState(options) {
6949
7396
  return {
6950
7397
  containerRef,
6951
7398
  tableRef,
7399
+ paginationSnapshot,
7400
+ paginationConfigRequest,
7401
+ closePaginationConfigRequest: () => setPaginationConfigRequest(null),
6952
7402
  editorRequest,
6953
7403
  paginationConfig,
6954
7404
  tooltipRequest,
@@ -7030,7 +7480,7 @@ function useStableTableProps(props) {
7030
7480
  }
7031
7481
  return handler;
7032
7482
  };
7033
- for (const key of ["onChange"]) {
7483
+ for (const key of ["onChange", "onPaginationConfigChange"]) {
7034
7484
  if (typeof props[key] === "function") next[key] = event(void 0, key);
7035
7485
  }
7036
7486
  for (const key of CONFIG_KEYS) {
@@ -7293,6 +7743,7 @@ function ReactListTableInner(props, ref) {
7293
7743
  rowSelection,
7294
7744
  expandable,
7295
7745
  pagination,
7746
+ onPaginationConfigChange,
7296
7747
  scrollbar,
7297
7748
  stickToBottom,
7298
7749
  carouselScroll,
@@ -7324,6 +7775,7 @@ function ReactListTableInner(props, ref) {
7324
7775
  }, [storageKey]);
7325
7776
  const shellRef = react.useRef(null);
7326
7777
  const [isFullscreen, setIsFullscreen] = react.useState(false);
7778
+ const [paginationHeight, setPaginationHeight] = react.useState(0);
7327
7779
  const [scrollbarOverride, setScrollbarOverride] = useStorageKeyState(
7328
7780
  storageKey,
7329
7781
  () => null
@@ -7380,11 +7832,13 @@ function ReactListTableInner(props, ref) {
7380
7832
  const queryRef = react.useRef(query);
7381
7833
  queryRef.current = retainEqualQueryOption(queryRef.current, query);
7382
7834
  const stableQuery = queryRef.current;
7835
+ const autoContentHeight = height == null && style?.height == null && scroll?.y == null ? (resolvedHeaderRowHeight ?? 40) + dataSource.length * (typeof resolvedRowHeight === "number" ? resolvedRowHeight : 40) + paginationHeight : void 0;
7836
+ const resolvedTableHeight = autoContentHeight ?? height;
7383
7837
  const options = react.useMemo(() => {
7384
7838
  const nextOptions = buildListTableOptions({
7385
7839
  exportOptions,
7386
7840
  width,
7387
- height,
7841
+ height: resolvedTableHeight,
7388
7842
  emptyText,
7389
7843
  scroll,
7390
7844
  locale,
@@ -7413,6 +7867,7 @@ function ReactListTableInner(props, ref) {
7413
7867
  rowSelection,
7414
7868
  expandable,
7415
7869
  pagination,
7870
+ onPaginationConfigChange,
7416
7871
  scrollbar: effectiveScrollbar,
7417
7872
  stickToBottom,
7418
7873
  carouselScroll,
@@ -7480,7 +7935,7 @@ function ReactListTableInner(props, ref) {
7480
7935
  }, [
7481
7936
  exportOptions,
7482
7937
  width,
7483
- height,
7938
+ resolvedTableHeight,
7484
7939
  emptyText,
7485
7940
  scroll,
7486
7941
  locale,
@@ -7509,6 +7964,7 @@ function ReactListTableInner(props, ref) {
7509
7964
  rowSelection,
7510
7965
  expandable,
7511
7966
  pagination,
7967
+ onPaginationConfigChange,
7512
7968
  effectiveScrollbar,
7513
7969
  stickToBottom,
7514
7970
  carouselScroll,
@@ -7528,6 +7984,9 @@ function ReactListTableInner(props, ref) {
7528
7984
  const {
7529
7985
  containerRef,
7530
7986
  tableRef,
7987
+ paginationSnapshot,
7988
+ paginationConfigRequest,
7989
+ closePaginationConfigRequest,
7531
7990
  editorRequest,
7532
7991
  paginationConfig,
7533
7992
  tooltipRequest,
@@ -7544,7 +8003,18 @@ function ReactListTableInner(props, ref) {
7544
8003
  } = useReactListTableState(options);
7545
8004
  const hasPagination = paginationConfig != null;
7546
8005
  const [cacheConfigOpen, setCacheConfigOpen] = react.useState(false);
7547
- const paginationLayout = resolveReactListTablePaginationLayout(resolvedRowHeight);
8006
+ const paginationLayout = resolveReactListTablePaginationLayout(
8007
+ resolvedRowHeight,
8008
+ paginationConfig?.size
8009
+ );
8010
+ react.useLayoutEffect(() => {
8011
+ setPaginationHeight(hasPagination ? paginationLayout.height : 0);
8012
+ }, [hasPagination, paginationLayout.height]);
8013
+ const paginationDialogSnapshot = usePaginationConfigDialog(
8014
+ paginationConfigRequest,
8015
+ paginationSnapshot,
8016
+ closePaginationConfigRequest
8017
+ );
7548
8018
  const portalContainer = resolveFullscreenPortalContainer(shellRef.current);
7549
8019
  const PrintHost = printIntegration?.Host;
7550
8020
  const contextMenuRequest = headerContextMenuRequest ? {
@@ -7577,6 +8047,11 @@ function ReactListTableInner(props, ref) {
7577
8047
  react.useImperativeHandle(
7578
8048
  ref,
7579
8049
  () => ({
8050
+ getPaginationConfig: () => tableRef.current?.getPaginationConfig() ?? null,
8051
+ setPaginationConfig: (value, cache) => tableRef.current?.setPaginationConfig(value, cache) ?? {
8052
+ ok: false,
8053
+ errors: { table: "\u8868\u683C\u5C1A\u672A\u6302\u8F7D" }
8054
+ },
7580
8055
  getDataSource: () => tableRef.current?.getDataSource() ?? [],
7581
8056
  getFilteredData: () => tableRef.current?.getFilteredData() ?? [],
7582
8057
  validate: () => tableRef.current?.validate() ?? Promise.resolve([]),
@@ -7592,6 +8067,19 @@ function ReactListTableInner(props, ref) {
7592
8067
  scrollTo: (options2) => {
7593
8068
  tableRef.current?.scrollTo(options2);
7594
8069
  },
8070
+ freezeRow: (targets) => {
8071
+ tableRef.current?.freezeRow(targets);
8072
+ },
8073
+ freezeRows: (targets) => {
8074
+ tableRef.current?.freezeRows(targets);
8075
+ },
8076
+ unfreezeRow: (targets) => {
8077
+ tableRef.current?.unfreezeRow(targets);
8078
+ },
8079
+ unfreezeRows: (targets) => {
8080
+ tableRef.current?.unfreezeRows(targets);
8081
+ },
8082
+ getFrozenRows: () => tableRef.current?.getFrozenRows() ?? [],
7595
8083
  getDebugSnapshot: () => tableRef.current?.getDebugSnapshot() ?? null,
7596
8084
  resetSorter: () => {
7597
8085
  tableRef.current?.resetSorter();
@@ -7756,6 +8244,18 @@ function ReactListTableInner(props, ref) {
7756
8244
  ]
7757
8245
  }
7758
8246
  ),
8247
+ paginationDialogSnapshot ? /* @__PURE__ */ jsxRuntime.jsx(
8248
+ ReactListTablePaginationConfigDialog,
8249
+ {
8250
+ snapshot: paginationDialogSnapshot,
8251
+ showTotal: pagination ? pagination.showTotal : void 0,
8252
+ onConfirm: (value, cache) => tableRef.current?.setPaginationConfig(value, cache) ?? {
8253
+ ok: false,
8254
+ errors: { table: "\u8868\u683C\u5C1A\u672A\u6302\u8F7D" }
8255
+ },
8256
+ onClose: closePaginationConfigRequest
8257
+ }
8258
+ ) : null,
7759
8259
  tooltipRequest ? reactDom.createPortal(
7760
8260
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactTooltip, { request: tooltipRequest }),
7761
8261
  portalContainer