1
1
import { ThemeDetail , ThemeType } from "api/commonSettingApi" ;
2
2
import { RecordConstructorToComp } from "lowcoder-core" ;
3
3
import { dropdownInputSimpleControl } from "comps/controls/dropdownInputSimpleControl" ;
4
- import { MultiCompBuilder , valueComp } from "comps/generators" ;
4
+ import { MultiCompBuilder , valueComp , withDefault } from "comps/generators" ;
5
5
import { AddIcon , Dropdown } from "lowcoder-design" ;
6
6
import { EllipsisSpan } from "pages/setting/theme/styledComponents" ;
7
7
import { useEffect } from "react" ;
@@ -14,6 +14,10 @@ import { default as Divider } from "antd/es/divider";
14
14
import { THEME_SETTING } from "constants/routesURL" ;
15
15
import { CustomShortcutsComp } from "./customShortcutsComp" ;
16
16
import { DEFAULT_THEMEID } from "comps/utils/themeUtil" ;
17
+ import { StringControl } from "comps/controls/codeControl" ;
18
+ import { IconControl } from "comps/controls/iconControl" ;
19
+ import { dropdownControl } from "comps/controls/dropdownControl" ;
20
+ import { ApplicationCategoriesEnum } from "constants/applicationConstants" ;
17
21
18
22
const TITLE = trans ( "appSetting.title" ) ;
19
23
const USER_DEFINE = "__USER_DEFINE" ;
@@ -92,9 +96,37 @@ const SettingsStyled = styled.div`
92
96
` ;
93
97
94
98
const DivStyled = styled . div `
95
- div {
96
- width: 100%;
97
- display: block;
99
+ > div {
100
+ flex-wrap: wrap;
101
+ margin-bottom: 12px;
102
+
103
+ > div {
104
+ width: 100%;
105
+ display: block;
106
+ }
107
+
108
+ > div:first-child {
109
+ margin-bottom: 6px;
110
+ }
111
+
112
+ .tooltipLabel {
113
+ white-space: nowrap;
114
+ }
115
+
116
+ }
117
+ // custom styles for icon selector
118
+ .app-icon {
119
+ > div {
120
+ margin-bottom: 0;
121
+
122
+ > div:first-child {
123
+ margin-bottom: 6px;
124
+ }
125
+ > div:nth-child(2) {
126
+ width: 88%;
127
+ display: inline-block;
128
+ }
129
+ }
98
130
}
99
131
` ;
100
132
@@ -134,7 +166,22 @@ const DividerStyled = styled(Divider)`
134
166
border-color: #e1e3eb;
135
167
` ;
136
168
169
+ type AppCategoriesEnumKey = keyof typeof ApplicationCategoriesEnum
170
+ const AppCategories = Object . keys ( ApplicationCategoriesEnum ) . map (
171
+ ( cat ) => {
172
+ const value = ApplicationCategoriesEnum [ cat as AppCategoriesEnumKey ] ;
173
+ return {
174
+ label : value ,
175
+ value,
176
+ }
177
+ }
178
+ )
179
+
137
180
const childrenMap = {
181
+ title : withDefault ( StringControl , '' ) ,
182
+ description : withDefault ( StringControl , '' ) ,
183
+ icon : IconControl ,
184
+ category : dropdownControl ( AppCategories , ApplicationCategoriesEnum . BUSINESS ) ,
138
185
maxWidth : dropdownInputSimpleControl ( OPTIONS , USER_DEFINE , "1920" ) ,
139
186
themeId : valueComp < string > ( DEFAULT_THEMEID ) ,
140
187
customShortcuts : CustomShortcutsComp ,
@@ -146,7 +193,16 @@ type ChildrenInstance = RecordConstructorToComp<typeof childrenMap> & {
146
193
} ;
147
194
148
195
function AppSettingsModal ( props : ChildrenInstance ) {
149
- const { themeList, defaultTheme, themeId, maxWidth } = props ;
196
+ const {
197
+ themeList,
198
+ defaultTheme,
199
+ themeId,
200
+ maxWidth,
201
+ title,
202
+ description,
203
+ icon,
204
+ category,
205
+ } = props ;
150
206
const THEME_OPTIONS = themeList ?. map ( ( theme ) => ( {
151
207
label : theme . name ,
152
208
value : theme . id + "" ,
@@ -182,16 +238,30 @@ function AppSettingsModal(props: ChildrenInstance) {
182
238
< SettingsStyled >
183
239
< Title > { TITLE } </ Title >
184
240
< DivStyled >
241
+ { title . propertyView ( {
242
+ label : trans ( "appSetting.appTitle" ) ,
243
+ placeholder : trans ( "appSetting.appTitle" )
244
+ } ) }
245
+ { description . propertyView ( {
246
+ label : trans ( "appSetting.appDescription" ) ,
247
+ placeholder : trans ( "appSetting.appDescription" )
248
+ } ) }
249
+ { category . propertyView ( {
250
+ label : trans ( "appSetting.appCategory" ) ,
251
+ } ) }
252
+ < div className = "app-icon" >
253
+ { icon . propertyView ( {
254
+ label : trans ( "icon" ) ,
255
+ tooltip : trans ( "aggregation.iconTooltip" ) ,
256
+ } ) }
257
+ </ div >
185
258
{ maxWidth . propertyView ( {
186
259
dropdownLabel : trans ( "appSetting.canvasMaxWidth" ) ,
187
260
inputLabel : trans ( "appSetting.userDefinedMaxWidth" ) ,
188
261
inputPlaceholder : trans ( "appSetting.inputUserDefinedPxValue" ) ,
189
262
placement : "bottom" ,
190
263
min : 350 ,
191
264
lastNode : < span > { trans ( "appSetting.maxWidthTip" ) } </ span > ,
192
- labelStyle : { marginBottom : "8px" } ,
193
- dropdownStyle : { marginBottom : "12px" } ,
194
- inputStyle : { marginBottom : "12px" }
195
265
} ) }
196
266
< Dropdown
197
267
defaultValue = {
@@ -205,8 +275,6 @@ function AppSettingsModal(props: ChildrenInstance) {
205
275
options = { THEME_OPTIONS }
206
276
label = { trans ( "appSetting.themeSetting" ) }
207
277
placement = "bottom"
208
- labelStyle = { { marginBottom : "8px" } }
209
- dropdownStyle = { { marginBottom : "12px" } }
210
278
itemNode = { ( value ) => < DropdownItem value = { value } /> }
211
279
preNode = { ( ) => (
212
280
< >
0 commit comments