1- import { styleControl } from "comps/controls/styleControl" ;
2- import { SelectStyle } from "comps/controls/styleControlConstants" ;
31import { trans } from "i18n" ;
42import {
5- CommonNameConfig , MultiBaseComp ,
3+ CommonNameConfig ,
4+ MultiBaseComp ,
65 NameConfig ,
76 stringExposingStateControl ,
87 UICompBuilder ,
@@ -13,54 +12,57 @@ import { baseSelectRefMethods, TourChildrenMap, TourPropertyView } from "./tourC
1312import { TourInputCommonConfig } from "./tourInputConstants" ;
1413import { Tour , TourProps } from "antd" ;
1514import { PlacementType } from "@lowcoder-ee/comps/controls/tourStepControl" ;
16- import { useContext } from "react" ;
15+ import React , { Suspense , useContext } from "react" ;
1716import { EditorContext } from "@lowcoder-ee/comps/editorState" ;
1817import { GridItemComp } from "@lowcoder-ee/comps/comps/gridItemComp" ;
1918import { HookComp } from "@lowcoder-ee/comps/hooks/hookComp" ;
2019import { TemporaryStateItemComp } from "@lowcoder-ee/comps/comps/temporaryStateComp" ;
21- import { delay } from "redux-saga/effects" ;
2220
2321/**
2422 * This component builds the Property Panel and the fake 'UI' for the Tour component
2523 */
26- let TourBasicComp = ( function ( ) {
24+ let TourBasicComp = ( function ( ) {
2725 const childrenMap = {
2826 ...TourChildrenMap ,
2927 defaultValue : stringExposingStateControl ( "defaultValue" ) ,
30- value : stringExposingStateControl ( "value" ) ,
28+ value : stringExposingStateControl ( "value" )
3129 // style: styleControl(SelectStyle),
3230 } ;
3331 return new UICompBuilder ( childrenMap , ( props , dispatch ) => {
3432 const editorState = useContext ( EditorContext ) ;
3533 const compMap : ( GridItemComp | HookComp | InstanceType < typeof TemporaryStateItemComp > ) [ ] = Object . values ( editorState . getAllUICompMap ( ) ) ;
36-
37- const steps : TourProps [ ' steps' ] = props . options . map ( ( step ) => {
34+
35+ const steps : TourProps [ " steps" ] = props . options . map ( ( step ) => {
3836 const targetName = step . target ;
3937 let target = undefined ;
4038 const compListItem = compMap . find ( ( compItem ) => compItem . children . name . getView ( ) === targetName ) ;
4139 if ( compListItem ) {
42- console . log ( `setting selected comp to ${ compListItem } ` )
40+ console . log ( `setting selected comp to ${ compListItem } ` ) ;
4341 try {
44- target = ( ( compListItem as MultiBaseComp ) . children . comp as GridItemComp ) . getRef ( ) ;
42+ target = ( ( compListItem as MultiBaseComp ) . children . comp as GridItemComp ) . getRef ?. ( ) ;
4543 } catch ( e ) {
46- target = ( ( compListItem as MultiBaseComp ) . children . comp as HookComp ) . getRef ( ) ;
44+ target = ( ( compListItem as MultiBaseComp ) . children . comp as HookComp ) . getRef ?. ( ) ;
4745 }
4846 }
49-
47+
5048 return {
5149 title : step . title ,
5250 description : step . description ,
5351 target : target ?. current ,
5452 arrow : step . arrow || true ,
55- placement : step . placement as PlacementType ,
56- }
57- } )
53+ placement : step . placement as PlacementType
54+ } ;
55+ } ) ;
5856
59- return ( < Tour
60- steps = { steps }
61- open = { props . open . value }
62- onClose = { ( ) => props . open . onChange ( false ) }
63- /> )
57+ return (
58+ < Suspense fallback = { < div > loading</ div > } >
59+ < Tour
60+ steps = { steps }
61+ open = { props . open . value }
62+ onClose = { ( ) => props . open . onChange ( false ) }
63+ />
64+ </ Suspense >
65+ ) ;
6466 } )
6567 . setPropertyViewFn ( ( children ) => < TourPropertyView { ...children } /> )
6668 . setExposeMethodConfigs ( baseSelectRefMethods )
@@ -72,17 +74,17 @@ TourBasicComp = withMethodExposing(TourBasicComp, [
7274 method : {
7375 name : "startTour" ,
7476 description : "Triggers the tour to start" ,
75- params : [ ] ,
77+ params : [ ]
7678 } ,
7779 execute : ( comp , values ) => {
78- comp . children . open . getView ( ) . onChange ( true )
80+ comp . children . open . getView ( ) . onChange ( true ) ;
7981 }
8082 }
81- ] )
83+ ] ) ;
8284
8385export const TourComp = withExposingConfigs ( TourBasicComp , [
8486 new NameConfig ( "value" , trans ( "selectInput.valueDesc" ) ) ,
8587 new NameConfig ( "inputValue" , trans ( "select.inputValueDesc" ) ) ,
8688 ...TourInputCommonConfig ,
87- ...CommonNameConfig ,
89+ ...CommonNameConfig
8890] ) ;
0 commit comments