11import type { Project , Event } from '@alilc/lowcode-shell' ;
2- import { ProjectSchema } from '@alilc/lowcode-types' ;
3- import { skeleton } from '@alilc/lowcode-engine' ;
2+ import { skeleton , common } from '@alilc/lowcode-engine' ;
43import {
54 beautifyCSS ,
65 compatGetSourceCodeMap ,
@@ -11,7 +10,6 @@ import {
1110 treeToMap ,
1211} from './utils' ;
1312import { FunctionEventParams , Monaco , ObjectType } from './types' ;
14- import { common } from '@alilc/lowcode-engine' ;
1513import type { editor } from 'monaco-editor' ;
1614import {
1715 addFunction ,
@@ -29,7 +27,7 @@ export * from './EditorHook';
2927
3028export interface EditorControllerState {
3129 declarationsMap : Record < string , string > ;
32- extraLibs : { path : string ; content : string } [ ] ;
30+ extraLibs : Array < { path : string ; content : string } > ;
3331}
3432
3533export type HookHandleFn < T = any > = ( fn : T ) => ( ) => void ;
@@ -51,7 +49,7 @@ export class EditorController extends EditorHook {
5149
5250 defaultFiles : ObjectType < string > ;
5351
54- public monaco ?: Monaco ;
52+ monaco ?: Monaco ;
5553
5654 private codeTemp ?: CodeTemp ;
5755
@@ -61,20 +59,20 @@ export class EditorController extends EditorHook {
6159
6260 private state : EditorControllerState ;
6361
64- public codeEditor ?: editor . IStandaloneCodeEditor ;
62+ codeEditor ?: editor . IStandaloneCodeEditor ;
6563
6664 private codeEditorCtx ?: EditorContextType ;
6765
68- public service ! : Service ;
66+ service ! : Service ;
6967
70- public onImportSchema : HookHandleFn <
71- ( schema : ProjectSchema ) => void | Promise < void >
72- > = this . hookFactory ( HookKeys . onImport ) ;
68+ onImportSchema : HookHandleFn < ( schema : any ) => void | Promise < void > > =
69+ this . hookFactory ( HookKeys . onImport ) ;
7370
74- public onSourceCodeChange : HookHandleFn < ( code : any ) => void > =
75- this . hookFactory ( HookKeys . onSourceCodeChange ) ;
71+ onSourceCodeChange : HookHandleFn < ( code : any ) => void > = this . hookFactory (
72+ HookKeys . onSourceCodeChange
73+ ) ;
7674
77- public onEditCodeChange : HookHandleFn <
75+ onEditCodeChange : HookHandleFn <
7876 ( code : { content : string ; file : string } ) => void
7977 > = this . hookFactory ( HookKeys . onEditCodeChange ) ;
8078
@@ -124,7 +122,7 @@ export class EditorController extends EditorHook {
124122 this . applyLibs ( ) ;
125123 }
126124
127- addComponentDeclarations ( list : [ string , string ] [ ] = [ ] ) {
125+ addComponentDeclarations ( list : Array < [ string , string ] > = [ ] ) {
128126 for ( const [ key , dec ] of list ) {
129127 this . state . declarationsMap [ key ] = dec ;
130128 }
@@ -133,7 +131,7 @@ export class EditorController extends EditorHook {
133131 }
134132
135133 private publishExtraLib ( ) {
136- const libs : { path : string ; content : string } [ ] = [ ] ;
134+ const libs : Array < { path : string ; content : string } > = [ ] ;
137135 this . extraLibMap . forEach ( ( content , path ) => libs . push ( { content, path } ) ) ;
138136 this . state . extraLibs = libs ;
139137 this . publish ( ) ;
@@ -156,7 +154,7 @@ export class EditorController extends EditorHook {
156154 const { getMonaco } = await import (
157155 '@alilc/lowcode-plugin-base-monaco-editor'
158156 ) ;
159- this . monaco = await getMonaco ( undefined ) ;
157+ this . monaco = await getMonaco ( undefined ) as any ;
160158 }
161159 const decStr = Object . keys ( this . state . declarationsMap ) . reduce (
162160 ( v , k ) => `${ v } \n${ k } : ${ this . state . declarationsMap [ k ] } ;\n` ,
@@ -175,7 +173,7 @@ export class EditorController extends EditorHook {
175173 } ) ;
176174 }
177175
178- getSchema ( pure ?: boolean ) : ProjectSchema {
176+ getSchema ( pure ?: boolean ) : any {
179177 const schema = this . project . exportSchema (
180178 common . designerCabin . TransformStage . Save
181179 ) ;
@@ -192,7 +190,7 @@ export class EditorController extends EditorHook {
192190 return schema ;
193191 }
194192
195- importSchema ( schema : ProjectSchema ) {
193+ importSchema ( schema : any ) {
196194 this . project . importSchema ( schema ) ;
197195 this . initCodeTempBySchema ( schema ) ;
198196 this . triggerHook ( HookKeys . onImport , schema ) ;
@@ -219,7 +217,7 @@ export class EditorController extends EditorHook {
219217 } ;
220218 }
221219
222- public initCodeTempBySchema ( schema : ProjectSchema ) {
220+ initCodeTempBySchema ( schema : any ) {
223221 const componentSchema = schema . componentsTree [ 0 ] || { } ;
224222 const { css, methods, state, lifeCycles } = componentSchema ;
225223 const codeMap = ( componentSchema as any ) . _sourceCodeMap ;
@@ -343,7 +341,7 @@ export class EditorController extends EditorHook {
343341 return true ;
344342 }
345343
346- public resetSaveStatus ( ) {
344+ resetSaveStatus ( ) {
347345 this . codeEditorCtx ?. updateState ( { modifiedKeys : [ ] } ) ;
348346 }
349347
0 commit comments