1
1
export function useCreateComponent ( importObj ) {
2
2
const createComponent = ( importObj ) => {
3
3
let imported = false ;
4
- if ( importObj . hasOwnProperty ( 'componentName' ) ) {
4
+ if ( importObj . hasOwnProperty ( 'componentName' ) ) {
5
5
imported = true ;
6
6
//Check if state and actions on import exist in the store. If not, add them.
7
- for ( let i = 0 ; i < importObj . actions . length ; i ++ ) {
8
- if ( ! this . userActions . includes ( importObj . actions [ i ] ) ) {
7
+ for ( let i = 0 ; i < importObj . actions . length ; i ++ ) {
8
+ if ( ! this . userActions . includes ( importObj . actions [ i ] ) ) {
9
9
this . createAction ( importObj . actions [ i ] )
10
10
}
11
11
}
12
- for ( let i = 0 ; i < importObj . state . length ; i ++ ) {
13
- if ( ! this . userState . includes ( importObj . state [ i ] ) ) {
12
+ for ( let i = 0 ; i < importObj . state . length ; i ++ ) {
13
+ if ( ! this . userState . includes ( importObj . state [ i ] ) ) {
14
14
this . createState ( importObj . state [ i ] )
15
15
}
16
16
}
17
- for ( let i = 0 ; i < importObj . props . length ; i ++ ) {
18
- if ( ! this . userProps . includes ( importObj . props [ i ] ) ) {
17
+ for ( let i = 0 ; i < importObj . props . length ; i ++ ) {
18
+ if ( ! this . userProps . includes ( importObj . props [ i ] ) ) {
19
19
this . createProp ( importObj . props [ i ] )
20
20
}
21
21
}
@@ -42,22 +42,23 @@ export function useCreateComponent(importObj) {
42
42
parent : { } ,
43
43
isActive : false ,
44
44
color : "#ffffff85" ,
45
- htmlAttributes :{
46
- class :"" ,
47
- id :"" ,
45
+ htmlAttributes : {
46
+ class : "" ,
47
+ id : "" ,
48
+ binding : "" ,
48
49
}
49
50
} ;
50
51
51
- if ( imported === true ) {
52
+ if ( imported === true ) {
52
53
component . componentName = importObj . componentName ;
53
54
component . htmlList = importObj . htmlList ;
54
55
component . actions = importObj . actions ;
55
56
component . state = importObj . state ;
56
57
component . props = importObj . props ;
57
58
} else {
58
- component . componentName = this . componentNameInputValue . replace ( / [ ^ a - z 0 - 9 - _ .] / gi, "" ) ;
59
+ component . componentName = this . componentNameInputValue . replace ( / [ ^ a - z 0 - 9 - _ .] / gi, "" ) ;
59
60
}
60
-
61
+
61
62
if ( ! this . componentMap [ component . componentName ] ) {
62
63
this . registerComponent ( component ) ;
63
64
this . setActiveComponent ( component . componentName ) ;
0 commit comments