3
0

Fix inputValue not being respected in Input Prompt

This commit is contained in:
Jože Fortun 2024-12-04 13:59:12 +01:00
parent 78b644a463
commit 61ca4be3ac
4 changed files with 44 additions and 27 deletions

View File

@ -132,7 +132,7 @@
@input="$root.$emit('change-detected')"
@search="searchWorkflows"
/>
<!-- Clearable -->
<c-input-select
v-else-if="a.input.type === 'select'"
v-model="a.value"

View File

@ -57,7 +57,7 @@ export const prompts = Object.freeze([
},
{
ref: 'refetchRecords',
meta: { short: 'Refreshes all record values on the page' },
meta: { short: 'Refresh all record values on the page' },
},
{
ref: 'notification',
@ -123,7 +123,7 @@ export const prompts = Object.freeze([
parameters: [
{ name: 'owner', types: ['User', 'ID'], required: false },
{ name: 'title', types: ['String'] },
{ name: 'variant', types: ['String'], meta: { visual: { input: { type: 'select', properties: { options: variants } } } } },
{ name: 'variant', types: ['String'], meta: { visual: { input: { type: 'select', properties: { options: variants }, default: 'primary' } } } },
{ name: 'message', types: ['String'], required: true },
{ name: 'label', types: ['String'] },
{
@ -131,15 +131,21 @@ export const prompts = Object.freeze([
types: ['String'],
meta: {
visual: {
options: [
{ value: 'text', text: 'Text' },
{ value: 'number', text: 'Number' },
{ value: 'email', text: 'Email' },
{ value: 'password', text: 'Password' },
{ value: 'search', text: 'Search' },
{ value: 'date', text: 'Date' },
{ value: 'time', text: 'Time' },
],
input: {
type: 'select',
properties: {
options: [
{ value: 'text', text: 'Text' },
{ value: 'number', text: 'Number' },
{ value: 'email', text: 'Email' },
{ value: 'password', text: 'Password' },
{ value: 'search', text: 'Search' },
{ value: 'date', text: 'Date' },
{ value: 'time', text: 'Time' },
],
},
default: 'text',
},
},
},
},
@ -163,10 +169,16 @@ export const prompts = Object.freeze([
types: ['String'],
meta: {
visual: {
options: [
{ value: 'select', text: 'Select' },
{ value: 'radio', text: 'Radio' },
],
input: {
type: 'select',
properties: {
options: [
{ value: 'select', text: 'Select' },
{ value: 'radio', text: 'Radio' },
],
},
default: 'select',
},
},
},
},

View File

@ -1,15 +1,18 @@
<template>
<div>
<p v-if="!!message" v-html="message" />
<p
v-if="!!message"
v-html="message"
/>
<b-form-group
:label="label"
label-class="text-primary"
>
<b-input
v-model="value"
:type="type"
:disabled="loading"
v-model="value"
/>
</b-form-group>
<b-button
@ -35,19 +38,16 @@ const validTypes = [
]
export default {
name: 'CPromptInput',
extends: base,
name: 'c-prompt-input',
data () {
return {
value: undefined
value: undefined,
}
},
beforeMount() {
this.value = this.pVal('value')
},
computed: {
type () {
const t = this.pVal('type', 'text')
@ -60,7 +60,11 @@ export default {
label () {
return this.pVal('label', '')
}
},
},
beforeMount () {
this.value = this.pVal('inputValue')
},
}

View File

@ -10,6 +10,7 @@ export default {
payload: {
type: Object,
default: () => ({}),
},
},
@ -33,8 +34,8 @@ export default {
return this.payload[k]
}
return { '@type': defType, '@value': defValue}
}
return { '@type': defType, '@value': defValue }
},
},
}
</script>