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

View File

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

View File

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

View File

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