9
9
<slot />
10
10
</app-btn >
11
11
<v-menu
12
- v-if =" paramList.length > 0 "
12
+ v-if =" hasParams "
13
13
left
14
14
offset-y
15
15
transition =" slide-y-transition"
34
34
<v-form @submit.prevent =" $emit('click', runCommand)" >
35
35
<v-card >
36
36
<v-card-text class =" pb-3 px-3" >
37
- <v-layout
38
- wrap
37
+ <v-row
38
+ v-for =" (param, key) in params"
39
+ :key =" key"
39
40
style =" max-width : 150px ;"
40
41
>
41
- <v-text-field
42
- v-for =" (param, i) in paramList"
43
- :key =" param"
44
- v-model =" params[param].value"
45
- :type =" isBasicGcodeCommand && !paramNameForRawGcodeCommand ? 'number' : undefined"
46
- :label =" param"
47
- persistent-placeholder
48
- outlined
49
- dense
50
- hide-details =" auto"
51
- spellcheck =" false"
52
- class =" console-command"
53
- :class =" { 'mb-3': (i < paramList.length - 1) }"
54
- @focus =" $event.target.select()"
55
- >
56
- <template #append >
57
- <app-btn
58
- v-if =" params[param].value !== params[param].reset"
59
- style =" margin-top : -4px ; margin-right : -6px ;"
60
- icon
61
- small
62
- @click =" params[param].value = params[param].reset"
63
- >
64
- <v-icon small >
65
- $reset
66
- </v-icon >
67
- </app-btn >
68
- </template >
69
- </v-text-field >
70
- </v-layout >
42
+ <v-col >
43
+ <v-text-field
44
+ v-model =" param.value"
45
+ :type =" isBasicGcodeCommand && !paramNameForRawGcodeCommand ? 'number' : undefined"
46
+ :label =" key"
47
+ persistent-placeholder
48
+ outlined
49
+ dense
50
+ hide-details =" auto"
51
+ spellcheck =" false"
52
+ class =" console-command"
53
+ :append-icon =" param.value !== param.reset ? '$reset' : undefined"
54
+ @click:append =" param.value = param.reset"
55
+ @focus =" $event.target.select()"
56
+ />
57
+ </v-col >
58
+ </v-row >
71
59
</v-card-text >
72
60
<v-divider />
73
61
<v-card-actions class =" px-3 py-3" >
@@ -104,6 +92,10 @@ export default class MacroBtn extends Mixins(StateMixin) {
104
92
105
93
params: Record <string , MacroParameter > = {}
106
94
95
+ get hasParams () {
96
+ return Object .keys (this .params ).length > 0
97
+ }
98
+
107
99
get macroName () {
108
100
return this .macro .name .toUpperCase ()
109
101
}
@@ -123,10 +115,6 @@ export default class MacroBtn extends Mixins(StateMixin) {
123
115
return listeners
124
116
}
125
117
126
- get paramList () {
127
- return Object .keys (this .params )
128
- }
129
-
130
118
/**
131
119
* The formatted run command for a macro.
132
120
*/
0 commit comments