Skip to content

Commit

Permalink
Fix inputValue not being respected in Input Prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
Fajfa committed Dec 4, 2024
1 parent 78b644a commit 61ca4be
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
42 changes: 27 additions & 15 deletions lib/vue/src/components/prompts/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -123,23 +123,29 @@ 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'] },
{
name: 'type',
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',
},
},
},
},
Expand All @@ -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',
},
},
},
},
Expand Down
22 changes: 13 additions & 9 deletions lib/vue/src/components/prompts/kinds/CPromptInput.vue
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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')
Expand All @@ -60,7 +60,11 @@ export default {
label () {
return this.pVal('label', '')
}
},
},
beforeMount () {
this.value = this.pVal('inputValue')
},
}
Expand Down
5 changes: 3 additions & 2 deletions lib/vue/src/components/prompts/kinds/base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default {
payload: {
type: Object,
default: () => ({}),
},
},
Expand All @@ -33,8 +34,8 @@ export default {
return this.payload[k]
}
return { '@type': defType, '@value': defValue}
}
return { '@type': defType, '@value': defValue }
},
},
}
</script>

0 comments on commit 61ca4be

Please sign in to comment.