Skip to content

Commit 1ea939d

Browse files
committed
style: use icon button on macro params field
Signed-off-by: Pedro Lamas <[email protected]>
1 parent fea1a27 commit 1ea939d

File tree

2 files changed

+43
-47
lines changed

2 files changed

+43
-47
lines changed

src/components/widgets/macros/MacroBtn.vue

+25-37
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<slot />
1010
</app-btn>
1111
<v-menu
12-
v-if="paramList.length > 0"
12+
v-if="hasParams"
1313
left
1414
offset-y
1515
transition="slide-y-transition"
@@ -34,40 +34,28 @@
3434
<v-form @submit.prevent="$emit('click', runCommand)">
3535
<v-card>
3636
<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"
3940
style="max-width: 150px;"
4041
>
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>
7159
</v-card-text>
7260
<v-divider />
7361
<v-card-actions class="px-3 py-3">
@@ -104,6 +92,10 @@ export default class MacroBtn extends Mixins(StateMixin) {
10492
10593
params: Record<string, MacroParameter> = {}
10694
95+
get hasParams () {
96+
return Object.keys(this.params).length > 0
97+
}
98+
10799
get macroName () {
108100
return this.macro.name.toUpperCase()
109101
}
@@ -123,10 +115,6 @@ export default class MacroBtn extends Mixins(StateMixin) {
123115
return listeners
124116
}
125117
126-
get paramList () {
127-
return Object.keys(this.params)
128-
}
129-
130118
/**
131119
* The formatted run command for a macro.
132120
*/

src/scss/inputs.scss

+18-10
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,28 @@
1515
width: 180px;
1616
}
1717

18-
.v-input--x-dense .v-input__slot {
19-
min-height: 25px !important;
20-
}
18+
.v-input--x-dense {
19+
.v-input__slot {
20+
min-height: 25px !important;
21+
}
2122

22-
.v-input--dense .v-input__slot {
23-
min-height: 36px !important;
24-
}
23+
.v-select__selections {
24+
padding: 2px 0 !important;
25+
}
2526

26-
.v-input--x-dense .v-select__selections {
27-
padding: 2px 0 !important;
27+
.v-input__append-inner {
28+
margin-top: 6px !important;
29+
}
2830
}
2931

30-
.v-input--x-dense .v-input__append-inner {
31-
margin-top: 6px !important;
32+
.v-input--dense {
33+
.v-input__slot {
34+
min-height: 36px !important;
35+
}
36+
37+
.v-input__append-inner {
38+
margin-top: 6px !important;
39+
}
3240
}
3341

3442
.v-text-field.v-text-field--solo .v-input__control{

0 commit comments

Comments
 (0)