11'use client' ;
22import { Space } from 'antd' ;
33import React , { FC } from 'react' ;
4- import { Controller } from 'react-hook-form' ;
4+ import { Controller , FormProvider } from 'react-hook-form' ;
55import { Col , Grid , Panel , PanelGroup , Row , Form } from 'rsuite' ;
66import { AppLayout } from '@/Layout/App' ;
77import { useNumberComma } from '@/app/number_comma/useNumberComma' ;
88import { CopyButton } from '@/components/common/CopyButton' ;
9+ import { ClearButton } from '@/components/common/Form/ClearButton' ;
910import { FormRow } from '@/components/common/Form/FormRow' ;
1011import { Input } from '@/components/common/Form/Input' ;
1112import { Select } from '@/components/common/Form/Select' ;
@@ -14,53 +15,59 @@ import { PanelHeader } from '@/components/common/PanelHeader';
1415
1516export const NumberComma : FC = ( ) => {
1617 const title = '数値区切り' ;
17- const { control , output, SEPARATOR_LIST , DEFAULT_VALUES } = useNumberComma ( ) ;
18+ const { methods , output, SEPARATOR_LIST , DEFAULT_VALUES } = useNumberComma ( ) ;
1819
1920 return (
20- < AppLayout >
21- < Grid fluid >
22- < PageTitle title = { title } />
23- < Row gutter = { 5 } >
24- < Col xs = { 24 } md = { 12 } >
25- < PanelGroup bordered >
26- < Panel header = { < PanelHeader title = "区切りたい数値" /> } >
27- < Controller
28- render = { ( { field } ) => < Input noResize = "none" { ...field } /> }
29- name = "input"
30- control = { control }
31- defaultValue = { DEFAULT_VALUES . input }
32- />
21+ < FormProvider { ...methods } >
22+ < AppLayout >
23+ < Grid fluid >
24+ < PageTitle title = { title } />
25+ < Row gutter = { 5 } >
26+ < Col xs = { 24 } md = { 12 } >
27+ < PanelGroup bordered >
28+ < Panel
29+ header = {
30+ < PanelHeader title = "区切りたい数値" right = { < ClearButton name = "input" /> } />
31+ }
32+ >
33+ < Controller
34+ render = { ( { field } ) => < Input noResize = "none" { ...field } /> }
35+ name = "input"
36+ control = { methods . control }
37+ defaultValue = { DEFAULT_VALUES . input }
38+ />
39+ </ Panel >
40+ < Panel bordered header = { < PanelHeader title = "設定" /> } >
41+ < Form fluid layout = "horizontal" >
42+ < FormRow label = "区切り文字" >
43+ < Controller
44+ render = { ( { field } ) => (
45+ < Select
46+ style = { { width : 250 } }
47+ options = { SEPARATOR_LIST }
48+ defaultValue = { DEFAULT_VALUES . separator }
49+ { ...field }
50+ />
51+ ) }
52+ name = "separator"
53+ control = { methods . control }
54+ />
55+ </ FormRow >
56+ </ Form >
57+ </ Panel >
58+ </ PanelGroup >
59+ </ Col >
60+ < Col xs = { 24 } md = { 12 } >
61+ < Panel bordered header = { < PanelHeader title = "区切った数値" /> } >
62+ < Space . Compact block >
63+ < Input noResize = "none" readOnly value = { output } />
64+ < CopyButton copyText = { output } />
65+ </ Space . Compact >
3366 </ Panel >
34- < Panel bordered header = { < PanelHeader title = "設定" /> } >
35- < Form fluid layout = "horizontal" >
36- < FormRow label = "区切り文字" >
37- < Controller
38- render = { ( { field } ) => (
39- < Select
40- style = { { width : 250 } }
41- options = { SEPARATOR_LIST }
42- defaultValue = { DEFAULT_VALUES . separator }
43- { ...field }
44- />
45- ) }
46- name = "separator"
47- control = { control }
48- />
49- </ FormRow >
50- </ Form >
51- </ Panel >
52- </ PanelGroup >
53- </ Col >
54- < Col xs = { 24 } md = { 12 } >
55- < Panel bordered header = { < PanelHeader title = "区切った数値" /> } >
56- < Space . Compact block >
57- < Input noResize = "none" readOnly value = { output } />
58- < CopyButton copyText = { output } />
59- </ Space . Compact >
60- </ Panel >
61- </ Col >
62- </ Row >
63- </ Grid >
64- </ AppLayout >
67+ </ Col >
68+ </ Row >
69+ </ Grid >
70+ </ AppLayout >
71+ </ FormProvider >
6572 ) ;
6673} ;
0 commit comments