11'use client' ;
2- import { DeleteOutlined } from '@ant-design/icons' ;
3- import PlusIcon from '@rsuite/icons/legacy/Plus' ;
4- import { Table , Form , Popconfirm , Button } from 'antd' ;
2+ import { DeleteOutlined , PlusOutlined } from '@ant-design/icons' ;
3+ import { Table , Form , Popconfirm , Button , Space } from 'antd' ;
54import type { DefaultOptionType } from 'antd/es/select' ;
65import type { ColumnsType } from 'antd/es/table' ;
76import React , { FC } from 'react' ;
87import { FormProvider , Controller } from 'react-hook-form' ;
98import type { Control , UseFormWatch } from 'react-hook-form/dist/types/form' ;
10- import { Grid , Row , Col , PanelGroup , Panel , IconButton } from 'rsuite' ;
9+ import { Grid , Row , Col , PanelGroup , Panel } from 'rsuite' ;
1110import { AppLayout } from '@/Layout/App' ;
12- import { dataTypeOptions } from '@/app/dummy_generator/facker ' ;
13- import type { DataType } from '@/app/dummy_generator/facker ' ;
11+ import { dataTypeOptions } from '@/app/dummy_generator/options ' ;
12+ import type { DataType } from '@/app/dummy_generator/options ' ;
1413import { AddressOptions } from '@/app/dummy_generator/options/AddressOptions' ;
1514import { NameOptions } from '@/app/dummy_generator/options/NameOptions' ;
1615import { useDummy , RecordType , DummyForm } from '@/app/dummy_generator/useDummy' ;
@@ -22,7 +21,7 @@ import { PanelHeader } from '@/components/common/PanelHeader';
2221
2322export const DummyGenerator : FC = ( ) => {
2423 const title = 'ダミー情報の生成' ;
25- const { methods, fields, output, onClickAdd, onClickDelete } = useDummy ( ) ;
24+ const { methods, fields, output, onClickAdd, onClickClear , onClickDelete } = useDummy ( ) ;
2625 const { watch, control } = methods ;
2726
2827 const source = fields . map ( ( value , index ) => {
@@ -64,25 +63,41 @@ export const DummyGenerator: FC = () => {
6463 < Col md = { 12 } xs = { 24 } >
6564 < Form layout = "horizontal" >
6665 < PanelGroup bordered >
67- < Panel bordered header = { < PanelHeader title = "管理" /> } >
68- < IconButton
69- icon = { < PlusIcon /> }
70- placement = "right"
71- size = "xs"
72- onClick = { onClickAdd }
73- >
74- 追加
75- </ IconButton >
76- </ Panel >
77- < Panel bordered header = { < PanelHeader title = "設定" /> } >
78- < Table columns = { columns } dataSource = { source } />
66+ < Panel bordered header = { < PanelHeader title = "管理" /> } > </ Panel >
67+ < Panel
68+ bordered
69+ header = {
70+ < PanelHeader
71+ title = "設定"
72+ right = {
73+ < Space . Compact block >
74+ < Button icon = { < PlusOutlined /> } size = "small" onClick = { onClickAdd } >
75+ 追加
76+ </ Button >
77+ < Popconfirm title = "全て削除していいですか?" onConfirm = { onClickClear } >
78+ < Button icon = { < DeleteOutlined /> } danger size = "small" >
79+ クリア
80+ </ Button >
81+ </ Popconfirm >
82+ </ Space . Compact >
83+ }
84+ />
85+ }
86+ >
87+ < Table
88+ pagination = { {
89+ pageSize : 20 ,
90+ } }
91+ columns = { columns }
92+ dataSource = { source }
93+ />
7994 </ Panel >
8095 </ PanelGroup >
8196 </ Form >
8297 </ Col >
8398 < Col md = { 12 } xs = { 24 } >
8499 < Panel bordered header = { < PanelHeader title = "テストデータ" /> } >
85- < TextArea value = { output } readOnly rows = { 20 } />
100+ < TextArea value = { output } readOnly rows = { 30 } />
86101 </ Panel >
87102 </ Col >
88103 </ Row >
0 commit comments