-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to modify the layout of the inputs
Note: the eslint rule 'vue/no-mutating-props' has been disabled. See vuejs/eslint-plugin-vue#1371
- Loading branch information
1 parent
c148ac2
commit b650cae
Showing
6 changed files
with
151 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,7 @@ module.exports = { | |
parserOptions: { | ||
ecmaVersion: "latest", | ||
}, | ||
rules: { | ||
"vue/no-mutating-props": "off", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script setup> | ||
import ModelParameter from "@/components/ModelParameter.vue"; | ||
import { useBackendStore } from "@/stores/backend"; | ||
const backend = useBackendStore(); | ||
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "props" }]*/ | ||
const props = defineProps({ | ||
component: Object, | ||
}); | ||
</script> | ||
|
||
<template lang="pug"> | ||
template(v-if="component.type==='input'") | ||
ModelParameter(:input="backend.findInput(component.id)") | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script setup> | ||
import Dropdown from "primevue/dropdown"; | ||
import InputNumber from "primevue/inputnumber"; | ||
import ModelParameterSlider from "@/components/ModelParameterSlider.vue"; | ||
import InputSwitch from "primevue/inputswitch"; | ||
import InputText from "primevue/inputtext"; | ||
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "props" }]*/ | ||
const props = defineProps({ | ||
input: Object, | ||
}); | ||
</script> | ||
|
||
<template lang="pug"> | ||
.field.grid(v-if="input.visible!==false && input.id !== 'prompt' && input.id !== 'access_code' && input.type!=='image' && input.type!=='image_mask'", :title="input.description" class="justify-content-center") | ||
template(v-if="input.type === 'int' || input.type === 'float'") | ||
ModelParameterSlider(:input="input") | ||
template(v-if="input.type == 'text' || input.type == 'choice' || input.type == 'bigint'") | ||
label(:for="'input_' + input.id" class="col-12 lg:col-4 justify-content-center lg:justify-content-end") | ||
| {{ input.label }} | ||
div(class="col-12 lg:col-6 lg:col-offset-1") | ||
template(v-if="input.type == 'text'") | ||
InputText.min-w-full(type="text", :id="'input_' + input.id", v-model="input.value") | ||
template(v-if="input.type == 'choice'") | ||
Dropdown(v-model="input.value" :options="input.validation.options" class="w-full lg:w-min") | ||
template(v-if="input.type == 'bigint'") | ||
InputNumber.flex(mode="decimal" showButtons v-model="input.value" :min="input.validation.min" :max="input.validation.max" :step="input.step ? input.step: 1" :title="input.description" :useGrouping="false") | ||
template(v-if="input.type == 'boolean'") | ||
label(:for="'input_' + input.id" class="col-6 lg:col-4 justify-content-center lg:justify-content-end") | ||
| {{ input.label }} | ||
div(class="col-6 lg:col-6 lg:col-offset-1") | ||
template(v-if="input.type == 'boolean'") | ||
InputSwitch(v-model="input.value") | ||
</template> | ||
|
||
<style scoped> | ||
.field { | ||
margin-bottom: 0.5rem; | ||
} | ||
.field > label { | ||
margin-bottom: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script setup> | ||
import InputSlider from "@/components/InputSlider.vue"; | ||
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "props" }]*/ | ||
const props = defineProps({ | ||
input: Object, | ||
}); | ||
</script> | ||
|
||
<template lang="pug"> | ||
label(:for="'input_' + input.id" class="col-10 lg:col-4 justify-content-center lg:justify-content-end") | ||
| {{ input.label }} | ||
span(class="inline lg:hidden") : {{input.value}} | ||
label(class="col-1 col-offset-1 hidden lg:block") | ||
| {{input.value}} | ||
div(class="col-12 lg:col-5") | ||
InputSlider(:label="input.label" v-model="input.value" :min="input.validation.min" :max="input.validation.max" :step="input.step ? input.step: 1" :title="input.description") | ||
</template> | ||
|
||
<style scoped> | ||
.field { | ||
margin-bottom: 0.5rem; | ||
} | ||
.field > label { | ||
margin-bottom: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters