@canvas-components/react-list-table 0.2.5 → 0.2.7

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.d.cts CHANGED
@@ -37,7 +37,7 @@ interface ReactListTableToolbarOptions {
37
37
  exportOptions?: ListTableExportXlsxOptions;
38
38
  onRefresh?: () => void;
39
39
  /** 表格密度变化回调,依次对应紧凑、中等和宽松。 */
40
- onDensityChange?: (density: 32 | 40 | 48) => void;
40
+ onDensityChange?: (density: 32 | 48 | 56) => void;
41
41
  /** 自定义导出行为;未配置时默认异步导出全量 XLSX 数据。 */
42
42
  onExport?: () => void;
43
43
  /** 自定义全屏节点,默认使用表格根容器。 */
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ interface ReactListTableToolbarOptions {
37
37
  exportOptions?: ListTableExportXlsxOptions;
38
38
  onRefresh?: () => void;
39
39
  /** 表格密度变化回调,依次对应紧凑、中等和宽松。 */
40
- onDensityChange?: (density: 32 | 40 | 48) => void;
40
+ onDensityChange?: (density: 32 | 48 | 56) => void;
41
41
  /** 自定义导出行为;未配置时默认异步导出全量 XLSX 数据。 */
42
42
  onExport?: () => void;
43
43
  /** 自定义全屏节点,默认使用表格根容器。 */
package/dist/index.js CHANGED
@@ -3435,7 +3435,7 @@ function ReactTableToolbar(props) {
3435
3435
  children: /* @__PURE__ */ jsx(ColumnHeightOutlined, {})
3436
3436
  }
3437
3437
  ),
3438
- densityOpen ? /* @__PURE__ */ jsx("div", { className: "react-list-table-tool-menu", children: [48, 40, 32].map((height) => /* @__PURE__ */ jsx(
3438
+ densityOpen ? /* @__PURE__ */ jsx("div", { className: "react-list-table-tool-menu", children: [56, 48, 32].map((height) => /* @__PURE__ */ jsx(
3439
3439
  "button",
3440
3440
  {
3441
3441
  type: "button",
@@ -3444,7 +3444,7 @@ function ReactTableToolbar(props) {
3444
3444
  props.onDensityChange(height);
3445
3445
  setDensityOpen(false);
3446
3446
  },
3447
- children: height === 48 ? "\u5BBD\u677E" : height === 40 ? "\u4E2D\u7B49" : "\u7D27\u51D1"
3447
+ children: height === 56 ? "\u5BBD\u677E" : height === 48 ? "\u4E2D\u7B49" : "\u7D27\u51D1"
3448
3448
  },
3449
3449
  height
3450
3450
  )) }) : null
@@ -3794,8 +3794,10 @@ function ReactListTableInner(props, ref) {
3794
3794
  [columns, columnVisibility, columnOrders, columnConfig]
3795
3795
  );
3796
3796
  const resolvedRowHeight = densityOverride ?? rowHeight;
3797
- const options = useMemo(
3798
- () => buildListTableOptions({
3797
+ const resolvedHeaderRowHeight = densityOverride ?? headerRowHeight;
3798
+ const resolvedSummaryRowHeight = densityOverride ?? summaryRowHeight;
3799
+ const options = useMemo(() => {
3800
+ const nextOptions = buildListTableOptions({
3799
3801
  width,
3800
3802
  height,
3801
3803
  emptyText,
@@ -3812,8 +3814,8 @@ function ReactListTableInner(props, ref) {
3812
3814
  contextMenu,
3813
3815
  grouping,
3814
3816
  rowHeight: resolvedRowHeight,
3815
- headerRowHeight,
3816
- summaryRowHeight,
3817
+ headerRowHeight: resolvedHeaderRowHeight,
3818
+ summaryRowHeight: resolvedSummaryRowHeight,
3817
3819
  overscanRowCount,
3818
3820
  query,
3819
3821
  rowSelector,
@@ -3829,43 +3831,49 @@ function ReactListTableInner(props, ref) {
3829
3831
  tableId,
3830
3832
  rowDrag,
3831
3833
  debug
3832
- }),
3833
- [
3834
- width,
3835
- height,
3836
- emptyText,
3837
- scroll,
3838
- locale,
3839
- onChange,
3840
- rowKey,
3841
- resolvedColumns,
3842
- dataSource,
3843
- onRow,
3844
- theme,
3845
- striped,
3846
- highlightMode,
3847
- contextMenu,
3848
- grouping,
3849
- resolvedRowHeight,
3850
- headerRowHeight,
3851
- summaryRowHeight,
3852
- overscanRowCount,
3853
- query,
3854
- rowSelector,
3855
- rowSelection,
3856
- expandable,
3857
- pagination,
3858
- scrollbar,
3859
- carouselScroll,
3860
- stretchColumns,
3861
- resizable,
3862
- storageKey,
3863
- draggable,
3864
- tableId,
3865
- rowDrag,
3866
- debug
3867
- ]
3868
- );
3834
+ });
3835
+ return {
3836
+ ...nextOptions,
3837
+ ui: {
3838
+ ...nextOptions.ui,
3839
+ onDensityChange: setDensityOverride
3840
+ }
3841
+ };
3842
+ }, [
3843
+ width,
3844
+ height,
3845
+ emptyText,
3846
+ scroll,
3847
+ locale,
3848
+ onChange,
3849
+ rowKey,
3850
+ resolvedColumns,
3851
+ dataSource,
3852
+ onRow,
3853
+ theme,
3854
+ striped,
3855
+ highlightMode,
3856
+ contextMenu,
3857
+ grouping,
3858
+ resolvedRowHeight,
3859
+ resolvedHeaderRowHeight,
3860
+ resolvedSummaryRowHeight,
3861
+ overscanRowCount,
3862
+ query,
3863
+ rowSelector,
3864
+ rowSelection,
3865
+ expandable,
3866
+ pagination,
3867
+ scrollbar,
3868
+ carouselScroll,
3869
+ stretchColumns,
3870
+ resizable,
3871
+ storageKey,
3872
+ draggable,
3873
+ tableId,
3874
+ rowDrag,
3875
+ debug
3876
+ ]);
3869
3877
  const {
3870
3878
  containerRef,
3871
3879
  tableRef,
@@ -3922,10 +3930,11 @@ function ReactListTableInner(props, ref) {
3922
3930
  title,
3923
3931
  toolbar,
3924
3932
  columns: resolvedColumns,
3925
- density: resolvedRowHeight === "auto" ? 40 : resolvedRowHeight ?? 40,
3933
+ density: resolvedRowHeight === "auto" ? 32 : resolvedRowHeight ?? 32,
3926
3934
  hostRef: shellRef,
3927
3935
  onExport: (options2) => tableRef.current?.exportXlsx(options2),
3928
3936
  onDensityChange: (density) => {
3937
+ tableRef.current?.changeDensity(density);
3929
3938
  setDensityOverride(density);
3930
3939
  if (toolbar) {
3931
3940
  toolbar.onDensityChange?.(density);