File tree Expand file tree Collapse file tree 5 files changed +41
-24
lines changed
components/titleWithToolbar
pages/playground/workbench Expand file tree Collapse file tree 5 files changed +41
-24
lines changed Original file line number Diff line number Diff line change 4343 "prettier" : " ^2.2.0" ,
4444 "typescript" : " ^4.7.4"
4545 },
46- "license" : " ISC"
46+ "license" : " ISC" ,
47+ "packageManager" : " pnpm@6.35.0"
48+
4749}
Original file line number Diff line number Diff line change 1010 font-weight : 500 ;
1111 }
1212 .toolbar-title-toolbar {
13- .anticon svg {
13+ height : 100% ;
14+ & > span {
15+ display : inline-flex ;
1416 cursor : pointer ;
15- font-size : 14px ;
16- margin-left : 12px ;
17+ padding : 0 6px ;
18+ height : 100% ;
19+ align-items : center ;
20+ .anticon svg {
21+ font-size : 14px ;
22+ }
1723 }
1824 }
1925}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import dataSyncFormMeta from '../formSample/jsonSample/dataSync';
1111import './index.less' ;
1212import type { DefaultOptionType } from 'antd/lib/select' ;
1313
14- const options : DefaultOptionType [ ] = [
14+ export const templateOptions : DefaultOptionType [ ] = [
1515 {
1616 label : '登录表单' ,
1717 value : JSON . stringify ( loginFormMeta , null , 4 ) ,
@@ -43,7 +43,7 @@ const TitleWithToolbar: React.FC<TitleWithToolbarProps> = (props) => {
4343 style = { { width : 150 , marginLeft : 12 } }
4444 placeholder = "选择模板以导入"
4545 value = { null }
46- options = { options }
46+ options = { templateOptions }
4747 onSelect = { ( value ) => {
4848 props . onImportTemplate ( value ) ;
4949 } }
@@ -52,28 +52,32 @@ const TitleWithToolbar: React.FC<TitleWithToolbarProps> = (props) => {
5252 </ p >
5353 < span className = "toolbar-title-toolbar" >
5454 { props . onDownload ? (
55- < Tooltip title = "下载" >
56- < DownloadOutlined
57- onClick = { ( ) => props . onDownload ?. ( ) }
58- / >
59- </ Tooltip >
55+ < span onClick = { ( ) => props . onDownload ?. ( ) } >
56+ < Tooltip title = "下载" >
57+ < DownloadOutlined />
58+ </ Tooltip >
59+ </ span >
6060 ) : null }
6161 { props . onCopy ? (
62- < Tooltip title = "复制" >
63- < CopyOutlined onClick = { ( ) => props . onCopy ?.( ) } />
64- </ Tooltip >
62+ < span onClick = { ( ) => props . onCopy ?.( ) } >
63+ < Tooltip title = "复制" >
64+ < CopyOutlined />
65+ </ Tooltip >
66+ </ span >
6567 ) : null }
6668 { props . onFormat ? (
67- < Tooltip title = "格式化" >
68- < FormatPainterOutlined
69- onClick = { ( ) => props . onFormat ?. ( ) }
70- / >
71- </ Tooltip >
69+ < span onClick = { ( ) => props . onFormat ?. ( ) } >
70+ < Tooltip title = "格式化" >
71+ < FormatPainterOutlined />
72+ </ Tooltip >
73+ </ span >
7274 ) : null }
7375 { props . onReload ? (
74- < Tooltip title = "刷新" >
75- < ReloadOutlined onClick = { ( ) => props . onReload ?.( ) } />
76- </ Tooltip >
76+ < span onClick = { ( ) => props . onReload ?.( ) } >
77+ < Tooltip title = "刷新" >
78+ < ReloadOutlined />
79+ </ Tooltip >
80+ </ span >
7781 ) : null }
7882 </ span >
7983 </ p >
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ const WorkBench: React.FC<workbenchProps> = () => {
2828 const file = files ?. find ( ( w ) => w . name === workInProgress ) ;
2929 setEditorValue ( configEditorRef . current , file ?. configContent ?? '' ) ;
3030 setEditorValue ( valueEditorRef . current , file ?. valuesContent ?? '' ) ;
31+ if ( file ?. valuesContent ) {
32+ refreshForm ( ) ;
33+ }
3134 } , [ workInProgress ] ) ;
3235
3336 const saveCurrentPage = debounceFunctionWrap ( ( ) => {
Original file line number Diff line number Diff line change 11import { createSlice } from '@reduxjs/toolkit' ;
22export const DefaultWip = 'untitled' ;
33
4+ import { templateOptions } from '@/components/titleWithToolbar' ;
5+
46export interface FileMetaType {
57 name : string ;
68 configContent : string ;
@@ -17,8 +19,8 @@ export const initialState: WorkbenchType = {
1719 files : [
1820 {
1921 name : DefaultWip ,
20- configContent : '' ,
21- valuesContent : '' ,
22+ configContent : templateOptions [ 1 ] . value as string ,
23+ valuesContent : '{} ' ,
2224 gmtModified : Date . now ( ) ,
2325 } ,
2426 ] ,
You can’t perform that action at this time.
0 commit comments