@@ -23,9 +23,8 @@ import { trans } from "i18n";
23
23
24
24
import { useContext } from "react" ;
25
25
import { EditorContext } from "comps/editorState" ;
26
- import { dropdownControl } from "comps/controls/dropdownControl" ;
27
26
import { controlItem } from "lowcoder-design" ;
28
- import { mapOptionsControl } from "comps/controls/optionsControl " ;
27
+ import { createNavItemsControl } from "./components/NavItemsControl " ;
29
28
30
29
type IProps = {
31
30
$justify : boolean ;
@@ -329,72 +328,3 @@ export const NavComp = withExposingConfigs(NavCompBase, [
329
328
NameConfigHidden ,
330
329
new NameConfig ( "items" , trans ( "navigation.itemsDesc" ) ) ,
331
330
] ) ;
332
-
333
- // ----------------------------------------
334
- // Nav Items Control (Manual / Map modes)
335
- // ----------------------------------------
336
- function createNavItemsControl ( ) {
337
- const OptionTypes = [
338
- { label : trans ( "prop.manual" ) , value : "manual" } ,
339
- { label : trans ( "prop.map" ) , value : "map" } ,
340
- ] as const ;
341
-
342
- const NavMapOption = new MultiCompBuilder (
343
- {
344
- label : StringControl ,
345
- hidden : BoolCodeControl ,
346
- disabled : BoolCodeControl ,
347
- active : BoolCodeControl ,
348
- onEvent : eventHandlerControl ( [ clickEvent ] ) ,
349
- } ,
350
- ( props ) => props
351
- )
352
- . setPropertyViewFn ( ( children ) => (
353
- < >
354
- { children . label . propertyView ( { label : trans ( "label" ) , placeholder : "{{item}}" } ) }
355
- { children . active . propertyView ( { label : trans ( "navItemComp.active" ) } ) }
356
- { children . hidden . propertyView ( { label : trans ( "hidden" ) } ) }
357
- { children . disabled . propertyView ( { label : trans ( "disabled" ) } ) }
358
- { children . onEvent . getPropertyView ( ) }
359
- </ >
360
- ) )
361
- . build ( ) ;
362
-
363
- const TmpNavItemsControl = new MultiCompBuilder (
364
- {
365
- optionType : dropdownControl ( OptionTypes , "manual" ) ,
366
- manual : navListComp ( ) ,
367
- mapData : mapOptionsControl ( NavMapOption ) ,
368
- } ,
369
- ( props ) => {
370
- return props . optionType === "manual" ? props . manual : props . mapData ;
371
- }
372
- )
373
- . setPropertyViewFn ( ( ) => {
374
- throw new Error ( "Method not implemented." ) ;
375
- } )
376
- . build ( ) ;
377
-
378
- return class NavItemsControl extends TmpNavItemsControl {
379
- exposingNode ( ) {
380
- return this . children . optionType . getView ( ) === "manual"
381
- ? ( this . children . manual as any ) . exposingNode ( )
382
- : ( this . children . mapData as any ) . exposingNode ( ) ;
383
- }
384
-
385
- propertyView ( ) {
386
- const isManual = this . children . optionType . getView ( ) === "manual" ;
387
- const content = isManual
388
- ? menuPropertyView ( this . children . manual as any )
389
- : this . children . mapData . getPropertyView ( ) ;
390
-
391
- return controlItem (
392
- { searchChild : true } ,
393
- < >
394
- { this . children . optionType . propertyView ( { radioButton : true , type : "oneline" } ) }
395
- { content }
396
- </ >
397
- ) ;
398
- }
399
- } ;
400
- }
0 commit comments