implement full width resize handler

オープン
#4,825 コメント 8 件 リアクション 23 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
typescript
領域
frontend

調査の方向性

まず header.getResizeHandler() と、issue で説明されている ColumnSizingState の動作を確認します。フル幅のハンドラーが、現在の列とその後で最初にリサイズ可能な列の最小サイズを守りながらテーブル全体の幅を維持する方法を判断し、その後、再現可能な例と関連する既存の resize テストで動作を検証します。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

The header.getResizeHandler() works well if the table is not full-width. But when working with full-width tables, it does not handle the ColumnSizingState properly.

Your minimal, reproducible example

none

Steps to reproduce

My idea is that we need full-width Resize Handler apart from normal Resize Handler when the table is full-width.

The normal Resize Handler updates the current column size in the ColumnSizingState, but full-width Resize Handler will update the size of both the current column and the next resizable column in the ColumnSizingState.

The logic is simple -->

  • if there is ANY resizable column after the current column (not need be adjacent, meaning one of the next columns), update the current column size like normal resize handler, and also, update the size of the FIRST resizable column as many as amount of the width change in negative to keep the table width the same.
  • if there is NO resizable column after the current column, do not update the current column size.
  • while updating the ColumnSizingState, respect the min width of the current column and the the FIRST resizable column in order to keep the column sizes in stable.
Expected behavior

I am volunteer to implement the full-width resize handler.

I want to get the package authors' idea and also others' about the way of implementation.

(assume we have a state variable for full width called isFullWidth)

Option-1

to create a separate resize handler --> header.getFullWidthResizeHandler()

the usage could be in the table:

<div
  {...{
    onMouseDown: isFullWidth ? header.getFullWidthResizeHandler() : header.getResizeHandler(),
    onTouchStart: isFullWidth ? header.getFullWidthResizeHandler() : header.getResizeHandler(),
  }}
/>
Option-2

to update the current getResizeHandler() having a parameter for full-width --> header.getResizeHandler(isFullWidth)

the usage could be in the table:

<div
  {...{
    onMouseDown: header.getResizeHandler(isFullWidth),
    onTouchStart: header.getResizeHandler(isFullWidth),
  }}
/>

After getting your opinions, I am going to proceed for the implementation and will make a PR.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

macos

react-table version

8.8.6

TypeScript version

4.9.4

Additional context

No response

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
主要言語
TypeScript
スター
28.6k
フォーク
3.6k
平均マージ
5時間 55分
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/table のほかの issue

TanStack/table の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。