Skip to content

Commit

Permalink
fix some default arg setting bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVipond committed May 17, 2021
1 parent d089305 commit b7ccc9f
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/interface/components/BaseRadioGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class="flex flex-col gap-3"
v-model="selectedOption"
>
<RadioGroupLabel class="input-label text-blue-gray-300">{{ label }}</RadioGroupLabel>
<RadioGroupLabel class="ml-3 input-label text-blue-gray-900">{{ label }}</RadioGroupLabel>
<div class="flex gap-4">
<RadioGroupOption
v-for="option in options"
Expand Down
8 changes: 7 additions & 1 deletion src/interface/components/FormArg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
type="text"
:placeholder="label"
v-model="arg"
:required="required"
/>
<FormConditions
v-model="arg"
Expand Down Expand Up @@ -43,7 +44,12 @@ import InputAttributeCaseSensitivity from './InputAttributeCaseSensitivity.vue'
import InputAttributeOperator from './InputAttributeOperator.vue'
import InputDirectionality from './InputDirectionality.vue'
import InputNthPattern from './InputNthPattern.vue'
import { attributeCaseSensitivityDefault, attributeOperatorDefault, nthPatternDefault, directionalityDefault } from '../options'
import {
attributeCaseSensitivityDefault,
attributeOperatorDefault,
nthPatternDefault,
directionalityDefault
} from '../options'
export default defineComponent({
components: {
Expand Down
8 changes: 7 additions & 1 deletion src/interface/components/FormCondition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<InputPipe
class="w-full"
:modelValue="pipeOption"
@update:modelValue="option => condition = ({ ...condition, args: [], pipe: option.value })"
@update:modelValue="option => condition = ({ ...condition, args: toDefaultValues(option.value), pipe: option.value })"
/>
<button
type="button"
Expand Down Expand Up @@ -49,6 +49,7 @@ export default defineComponent({
const condition = computed<Condition>({
get: () => props.modelValue,
set: value => {
console.log({ pipe: pipe.value, value })
emit('update:modelValue', value)
}
}),
Expand All @@ -67,7 +68,12 @@ export default defineComponent({
pipeOption,
createReplace,
emitDelete,
toDefaultValues,
}
}
})
function toDefaultValues (label) {
return pipeMetadata.find(({ label: l }) => l === label).args.map(({ defaultValue }) => defaultValue)
}
</script>
4 changes: 2 additions & 2 deletions src/interface/options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const directionalities = [
{ label: 'left to right', value: 'ltr' },
{ label: 'right to left', value: 'ltr' }
{ label: 'right to left', value: 'rtl' }
]

export const directionalityDefault = directionalities[0]
Expand Down Expand Up @@ -37,9 +37,9 @@ export const attributeOperatorDefault = attributeOperators[0]


export const attributeCaseSensitivities = [
{ label: 'unspecified', value: 'unspecified' },
{ label: 'sensitive', value: true },
{ label: 'insensitive', value: false },
{ label: 'unspecified', value: 'unspecified' },
]
export const attributeCaseSensitivityDefault = attributeCaseSensitivities[0]

Expand Down
Loading

0 comments on commit b7ccc9f

Please sign in to comment.