Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rowspan support for ListTable #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions __tests__/types/flow/lv1.js
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,7 @@ export default function App() {
url="/hoge/fuga"
onSelfWindowNavigation={() => {}}
colSpan={2}
rowSpan={2}
indentLevel={2}
{...commonProps}
>
Expand Down
3 changes: 3 additions & 0 deletions __tests__/types/flow/lv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,7 @@ export default function App() {
alignRight: true,
small: true,
colSpan: 2,
rowSpan: 2,
'data-masking': true,
'data-test': 'test',
},
Expand Down Expand Up @@ -1103,6 +1104,7 @@ export default function App() {
alignRight: true,
small: true,
colSpan: 2,
rowSpan: 2,
'data-test': 'test',
},
{ value: '2' },
Expand All @@ -1122,6 +1124,7 @@ export default function App() {
alignRight: true,
small: true,
colSpan: 2,
rowSpan: 2,
},
{ value: '2' },
],
Expand Down
1 change: 1 addition & 0 deletions lv1.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ class TableListCell extends React.Component<{|
alignTop?: boolean,
onSelfWindowNavigation?: (url?: string) => void | Promise<void>,
colSpan?: number,
rowSpan?: number,
indentLevel?: number,
...CommonProps,
|}> {}
Expand Down
1 change: 1 addition & 0 deletions lv2.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export type TableCell = {|
alignTop?: boolean,
small?: boolean,
colSpan?: number,
rowSpan?: number,
'data-masking'?: boolean,
'data-test'?: string,
|};
Expand Down
11 changes: 10 additions & 1 deletion src/lv1/lists/TableListCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ type Props = {
* colSpanを設定します
*/
colSpan?: number;
/**
* rowSpanを設定します
*/
rowSpan?: number;
/**
* ツリー状の表現のためのインデントレベルです。左端のカラムにのみ使われる想定です
*/
Expand All @@ -58,6 +62,7 @@ const TableListCell: React.FC<Props> = (props: Props) => {
alignTop,
breakWord,
colSpan,
rowSpan,
indentLevel,
onSelfWindowNavigation,
} = props;
Expand All @@ -75,7 +80,11 @@ const TableListCell: React.FC<Props> = (props: Props) => {
const textNodeId = `${uniqueId}__text`;

return (
<td {...commonProps(props, listBaseClass, classModifier)} colSpan={colSpan}>
<td
{...commonProps(props, listBaseClass, classModifier)}
colSpan={colSpan}
rowSpan={rowSpan}
>
{/* IEのみdisplay:tableで表示するため、indentContainerWrapperが必要 */}
<span className="vb-tableListCell__indentContainerWrapper">
<span className="vb-tableListCell__indentContainer">
Expand Down
12 changes: 11 additions & 1 deletion src/lv2/listTable/ListTable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,24 @@ const rows = [
{
cells: [
{ value: 'テーブルリスト' },
{ value: 'テーブルリスト' },
{
value: '結合セル',
rowSpan: 2,
},
{
value: '結合セル',
colSpan: 2,
alignCenter: true,
},
],
},
{
cells: [
{ value: 'テーブルリスト' },
{ value: 'テーブルリスト' },
{ value: 'テーブルリスト' },
],
},
];

export default {
Expand Down
2 changes: 2 additions & 0 deletions src/lv2/listTable/ListTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export type TableCell = {
*/
breakWord?: boolean;
colSpan?: number;
rowSpan?: number;
'data-masking'?: boolean;
'data-test'?: string;
};
Expand Down Expand Up @@ -187,6 +188,7 @@ const ListTable: React.FC<Props> = (props: Props) => {
onSelfWindowNavigation={row.onSelfWindowNavigation}
breakWord={cell.breakWord}
colSpan={cell.colSpan}
rowSpan={cell.rowSpan}
data-masking={cell['data-masking']}
data-test={cell['data-test']}
>
Expand Down