File tree Expand file tree Collapse file tree 4 files changed +32
-19
lines changed Expand file tree Collapse file tree 4 files changed +32
-19
lines changed Original file line number Diff line number Diff line change 1
1
<template lang="pug">
2
- draggable.dragArea ( tag ="ul" : list= "children" : group= "group" )
2
+ draggable.dragArea ( tag ="ul" : list= "children" : group= "group" : clone = "onClone" )
3
3
li( v-for ="child in children" )
4
4
div( v-if ="child.type === 'if'" )
5
5
| if {{ child.condition }}
6
6
Block.child ( :children ="child.children" )
7
7
div( v-else-if ="child.type === 'callMars'" )
8
- | call {{ child.func }}
8
+ | {{ child.func }}
9
+ BlockParamEditor(
10
+ v-for ="(param, i) in marsFuncs.find(func => child.func === func.name).parameters"
11
+ v-model ="child.params[i]"
12
+ :type ="param"
13
+ )
9
14
</template >
10
15
11
16
<script >
12
17
import draggable from ' vuedraggable'
18
+ import BlockParamEditor from " ./BlockParamEditor"
19
+ import { FUNCTIONS_ONLY } from " ../constants"
20
+ import _ from " lodash"
13
21
14
22
export default {
15
23
name: ' Block' ,
16
24
components: {
17
25
draggable,
26
+ BlockParamEditor,
18
27
},
19
28
props: {
20
29
children: {
@@ -32,12 +41,12 @@ export default {
32
41
? { name: ' blocks' , pull: ' clone' , put: false }
33
42
: { name: ' blocks' }
34
43
},
44
+ marsFuncs : () => FUNCTIONS_ONLY
35
45
},
36
46
methods: {
37
- put (... args ) {
38
- console .log (args)
39
- return true
40
- },
47
+ onClone (data ) {
48
+ return _ .cloneDeep (data)
49
+ }
41
50
},
42
51
}
43
52
</script >
Original file line number Diff line number Diff line change 6
6
.flex-grow-2
7
7
h6.font-weight-bold Nico
8
8
Block( :children ="nicoFuncs" : clone= "true" )
9
+ | {{ blocksRoot }}
9
10
.flex-grow-1.p-3
10
11
Block( :children ="blocksRoot" )
11
12
</template >
@@ -31,6 +32,7 @@ export default {
31
32
{
32
33
type: ' callMars' ,
33
34
func: ' sprite' ,
35
+ params: [],
34
36
},
35
37
],
36
38
}
Original file line number Diff line number Diff line change 1
1
<template lang="pug">
2
- div
3
- div( v-if )
2
+ .d-inline
3
+ .d-inline ( v-if ="type.type === 'str'" )
4
+ input( v-bind:value ="value" v-on:input ="$emit('input', $event.target.value)" )
5
+ .d-inline ( v-if ="type.type === 'num'" )
6
+ input.w-25 (
7
+ type ="number"
8
+ v-bind:value ="value"
9
+ v-on:input ="$emit('input', $event.target.value)"
10
+ )
4
11
</template >
5
12
6
13
<script >
7
14
export default {
8
15
name: ' BlockParamEditor' ,
9
16
props: {
10
- param: {
11
- type: {
12
- name: String ,
13
- type: String ,
14
- },
17
+ value: {
15
18
required: true ,
16
19
},
17
- value : {
20
+ type : {
18
21
required: true ,
19
22
}
20
23
},
Original file line number Diff line number Diff line change @@ -160,8 +160,7 @@ export const FUNCTIONS = [
160
160
] . reverse ( )
161
161
// reverse is because the sections appear in reverse order due to the rotation
162
162
163
- export const FUNCTIONS_BARE =
164
- FUNCTIONS | >
165
- _ . filter ( section => section . name !== 'User' ) | >
166
- _ . flatMap ( 'functions' ) | >
167
- _ . map ( 'name' )
163
+ export const FUNCTIONS_ONLY =
164
+ FUNCTIONS | > _ . filter ( section => section . name !== 'User' ) | > _ . flatMap ( 'functions' )
165
+
166
+ export const FUNCTIONS_BARE = FUNCTIONS_ONLY | > _ . map ( 'name' )
You can’t perform that action at this time.
0 commit comments