Skip to content

Commit ca087b7

Browse files
committed
refactor: simplify custom component properties
Signed-off-by: Pedro Lamas <[email protected]>
1 parent 8a28756 commit ca087b7

17 files changed

+23
-102
lines changed

src/components/settings/cameras/CameraConfigDialog.vue

+2-12
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,12 @@
5959
filled
6060
dense
6161
hide-details="auto"
62-
initial-value="false"
6362
:items="[
6463
{ text: $t('app.setting.camera_rotate_options.none'), value: 0 },
6564
{ text: $t('app.setting.camera_rotate_options.90'), value: 90 },
6665
{ text: $t('app.setting.camera_rotate_options.180'), value: 180 },
6766
{ text: $t('app.setting.camera_rotate_options.270'), value: 270 }
6867
]"
69-
item-value="value"
70-
item-text="text"
7168
/>
7269
</app-setting>
7370

@@ -89,18 +86,13 @@
8986
{ text: $t('app.setting.camera_type_options.video'), value: 'ipstream' },
9087
{ text: $t('app.setting.camera_type_options.iframe'), value: 'iframe' }
9188
]"
92-
item-value="value"
93-
item-text="text"
9489
/>
9590
</app-setting>
9691

9792
<v-divider />
9893

9994
<template v-if="camera.service === 'mjpegstreamer-adaptive'">
100-
<app-setting
101-
102-
:title="$t('app.setting.label.fps_target')"
103-
>
95+
<app-setting :title="$t('app.setting.label.fps_target')">
10496
<v-text-field
10597
v-model.number="camera.target_fps"
10698
class="mt-5"
@@ -116,9 +108,7 @@
116108

117109
<v-divider />
118110

119-
<app-setting
120-
:title="$t('app.setting.label.fps_idle_target')"
121-
>
111+
<app-setting :title="$t('app.setting.label.fps_idle_target')">
122112
<v-text-field
123113
v-model.number="camera.target_fps_idle"
124114
class="mt-5"

src/components/settings/console/ConsoleFilterDialog.vue

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
single-line
5050
hide-details="auto"
5151
:items="types"
52-
item-value="value"
53-
item-text="text"
5452
/>
5553
</app-setting>
5654

src/components/settings/timelapse/subsettings/ToolheadParkingSettings.vue

-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@
7272
hide-details="auto"
7373
:items="parkPositions"
7474
:disabled="parkposBlocked"
75-
item-value="value"
76-
item-text="text"
7775
/>
7876
</app-setting>
7977

src/components/ui/AppBtnToggle.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<template>
22
<v-btn-toggle
33
v-model="inputValue"
4-
v-bind="$attrs"
54
:class="{
65
'elevation-2': !disabled
76
}"
7+
v-bind="$attrs"
88
v-on="$listeners"
99
>
1010
<slot />

src/components/ui/AppBtnToolheadMove.vue

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<template>
22
<v-tooltip
3+
:disabled="!tooltip"
34
top
45
>
56
<template #activator="{ on, attrs }">
67
<app-btn
78
:disabled="disabled"
89
min-width="40"
9-
:loading="loading"
1010
:color="color"
11-
v-bind="(tooltip !== '') ? attrs : undefined"
1211
class="px-2"
12+
v-bind="{...$attrs, ...attrs}"
13+
v-on="{...$listeners, ...on}"
1314
@click="$emit('click')"
14-
v-on="(tooltip !== '') ? on : undefined"
1515
>
1616
<v-icon
1717
v-if="icon"
@@ -41,11 +41,8 @@ export default class AppBtnToolheadMove extends Vue {
4141
@Prop({ type: String, default: 'btncolor' })
4242
readonly color!: string
4343
44-
@Prop({ type: Boolean })
45-
readonly loading?: boolean
46-
47-
@Prop({ type: String, default: '' })
48-
readonly tooltip!: string
44+
@Prop({ type: String })
45+
readonly tooltip?: string
4946
5047
@Prop({ type: Boolean })
5148
readonly smallIcon?: boolean

src/components/ui/AppChipColor.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<template>
22
<v-chip
3-
v-bind="$attrs"
43
:style="{
54
background: color
65
}"
76
small
7+
v-bind="$attrs"
88
v-on="$listeners"
99
>
1010
<slot />

src/components/ui/AppDataTableCellColors.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
>
88
<template #activator="{ on, attrs }">
99
<app-chip-color
10-
v-bind="{...$attrs, ...attrs}"
1110
:color="color"
1211
:class="{
1312
'ms-1': index > 0
1413
}"
14+
v-bind="{...$attrs, ...attrs}"
1515
v-on="{...$listeners, ...on }"
1616
/>
1717
</template>

src/components/ui/AppDataTableCellTemps.vue

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
'ms-1': index > 0
88
}"
99
small
10+
v-bind="$attrs"
11+
v-on="$listeners"
1012
>
1113
{{ temp }}<small>°C</small>
1214
</v-chip>

src/components/ui/AppDialog.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
v-model="open"
44
:scrollable="scrollable"
55
:persistent="persistent"
6-
v-bind="$attrs"
76
:fullscreen="isMobileViewport"
87
:transition="isMobileViewport ? 'dialog-bottom-transition' : undefined"
8+
v-bind="$attrs"
99
v-on="$listeners"
1010
>
1111
<v-form

src/components/ui/AppDragOverlay.vue

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<v-overlay
3-
v-bind="$attrs"
43
class="dragOverlay"
5-
:value="value"
64
:opacity="0.85"
5+
v-bind="$attrs"
6+
v-on="$listeners"
77
>
88
<v-container>
99
<v-row
@@ -37,9 +37,6 @@ import { Component, Prop, Vue } from 'vue-property-decorator'
3737
inheritAttrs: false
3838
})
3939
export default class AppDragOverlay extends Vue {
40-
@Prop({ type: Boolean })
41-
readonly value?: boolean
42-
4340
@Prop({ type: String, required: true })
4441
readonly message!: string
4542

src/components/ui/AppInlineHelp.vue

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
>
88
<template #activator="{ on, attrs }">
99
<v-icon
10-
v-bind="attrs"
1110
:color="type"
12-
:small="small"
1311
class="ml-2"
14-
v-on="on"
12+
v-bind="{...$attrs, attrs}"
13+
v-on="{...$listeners, ...on}"
1514
>
1615
{{ (type === 'error' || type === 'warning') ? '$warning' : '$help' }}
1716
</v-icon>
@@ -44,8 +43,5 @@ export default class AppInlineHelp extends Vue {
4443
4544
@Prop({ type: Boolean })
4645
readonly right?: boolean
47-
48-
@Prop({ type: Boolean })
49-
readonly small?: boolean
5046
}
5147
</script>

src/components/ui/AppNamedSelect.vue

+1-24
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,12 @@
1212
<v-select
1313
v-model="inputValue"
1414
class="mt-0"
15-
:items="items"
1615
:disabled="disabled || loading"
17-
:prefix="prefix"
18-
:suffix="suffix"
19-
:item-value="itemValue"
20-
:item-text="itemText"
21-
:return-object="returnObject"
2216
dense
2317
single-line
2418
outlined
2519
hide-details
20+
v-bind="$attrs"
2621
v-on="$listeners"
2722
>
2823
<template #prepend>
@@ -57,9 +52,6 @@ export default class AppNamedSelect extends Vue {
5752
@Prop({ })
5853
readonly resetValue?: unknown
5954
60-
@Prop({ type: Array })
61-
readonly items?: unknown[]
62-
6355
@Prop({ type: String, required: true })
6456
readonly label!: string
6557
@@ -69,21 +61,6 @@ export default class AppNamedSelect extends Vue {
6961
@Prop({ type: Boolean })
7062
readonly loading?: boolean
7163
72-
@Prop({ type: String })
73-
readonly prefix?: string
74-
75-
@Prop({ type: String })
76-
readonly suffix?: string
77-
78-
@Prop({ type: String })
79-
readonly itemValue?: string
80-
81-
@Prop({ type: String })
82-
readonly itemText?: string
83-
84-
@Prop({ type: Boolean })
85-
readonly returnObject?: boolean
86-
8764
handleReset () {
8865
if (this.resetValue !== undefined) {
8966
this.$emit('change', this.resetValue)

src/components/ui/AppNamedSlider.vue

+1-8
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
<v-col>
2020
<v-text-field
2121
v-model="currentValue"
22-
:prefix="prefix"
23-
:suffix="suffix"
2422
:rules="textRules"
2523
:disabled="disabled || loading"
2624
:step="step"
@@ -30,6 +28,7 @@
3028
single-line
3129
outlined
3230
hide-details
31+
v-bind="$attrs"
3332
@focus="handleFocus"
3433
@blur="handleBlur"
3534
@keyup.enter.exact="handleSubmit(+currentValue)"
@@ -123,12 +122,6 @@ export default class AppNamedSlider extends Vue {
123122
@Prop({ type: Number, default: 1 })
124123
readonly step!: number
125124
126-
@Prop({ type: String })
127-
readonly prefix?: string
128-
129-
@Prop({ type: String })
130-
readonly suffix?: string
131-
132125
@Prop({ type: Boolean })
133126
readonly fullWidth?: boolean
134127

src/components/ui/AppNamedSwitch.vue

+1-8
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
v-model="inputValue"
1313
class="mt-0"
1414
:disabled="disabled || loading"
15-
:true-value="trueValue"
16-
:false-value="falseValue"
1715
hide-details
16+
v-bind="$attrs"
1817
v-on="$listeners"
1918
/>
2019
</v-layout>
@@ -38,11 +37,5 @@ export default class AppNamedSwitch extends Vue {
3837
3938
@Prop({ type: Boolean })
4039
readonly loading?: boolean
41-
42-
@Prop({ })
43-
readonly trueValue?: unknown
44-
45-
@Prop({ })
46-
readonly falseValue?: unknown
4740
}
4841
</script>

src/components/ui/AppNamedTextField.vue

+1-21
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@
1111
<v-col>
1212
<app-text-field
1313
v-model="inputValue"
14-
:type="type"
1514
:disabled="disabled || loading"
16-
:readonly="readonly"
17-
:prefix="prefix"
18-
:suffix="suffix"
19-
:rules="rules"
2015
class="v-input--text-right"
2116
dense
2217
single-line
2318
hide-details
2419
outlined
20+
v-bind="$attrs"
2521
v-on="$listeners"
2622
>
2723
<template #prepend>
@@ -46,7 +42,6 @@
4642
<script lang="ts">
4743
import { Component, Mixins, Prop, VModel } from 'vue-property-decorator'
4844
import StateMixin from '@/mixins/state'
49-
import type { InputValidationRules } from 'vuetify'
5045
5146
@Component({
5247
inheritAttrs: false
@@ -55,33 +50,18 @@ export default class AppNamedTextField extends Mixins(StateMixin) {
5550
@VModel({ })
5651
inputValue?: unknown
5752
58-
@Prop({ type: String })
59-
readonly type?: string
60-
6153
@Prop({ type: String, required: true })
6254
readonly label!: string
6355
6456
@Prop({ })
6557
readonly resetValue?: unknown
6658
67-
@Prop({ type: Boolean })
68-
readonly readonly?: boolean
69-
7059
@Prop({ type: Boolean })
7160
readonly disabled?: boolean
7261
7362
@Prop({ type: Boolean })
7463
readonly loading?: boolean
7564
76-
@Prop({ type: String })
77-
readonly prefix!: string
78-
79-
@Prop({ type: String })
80-
readonly suffix!: string
81-
82-
@Prop({ type: Array })
83-
readonly rules?: InputValidationRules[]
84-
8565
handleReset () {
8666
if (this.resetValue !== undefined) {
8767
this.inputValue = this.resetValue

src/components/ui/AppSetting.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<v-row
33
no-gutters
4-
v-bind="$attrs"
54
:class="{
65
'sc-link': hasClick
76
}"
87
class="app-setting-control"
8+
v-bind="$attrs"
99
v-on="$listeners"
1010
>
1111
<div

src/components/ui/AppTextFieldWithCopy.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<v-text-field
33
v-model="inputValue"
4-
v-bind="$attrs"
54
class="app-text-field"
5+
v-bind="$attrs"
66
v-on="$listeners"
77
>
88
<template #append-outer>

0 commit comments

Comments
 (0)