Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Add option to pass props to custom components #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
441 changes: 217 additions & 224 deletions dist/VueQueryBuilder.common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueQueryBuilder.common.js.map

Large diffs are not rendered by default.

441 changes: 217 additions & 224 deletions dist/VueQueryBuilder.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueQueryBuilder.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueQueryBuilder.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueQueryBuilder.umd.min.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ Each object in the `rules` array can contain the following properties:
<td>An imported component</td>
<td><Badge text="may be equired" type="error" vertical="middle" /> Required for type <code>custom-component</code>. <br><br>Ex: <code>component: RangeInput</code></td>
</tr>
<tr>
<td>customComponentProps</td>
<td>Object to pass down to a custom component</td>
<td><Badge text="may be required" type="error" vertical="middle" /> Required for type <code>custom-component</code>. <br><br>Ex: <code>customComponentProps: {name: 'John'}</code></td>
</tr>
</tbody>
</table>

Expand Down
2 changes: 1 addition & 1 deletion src/components/QueryBuilderRule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<input :class="{ 'form-control': styled }" v-if="rule.inputType === 'date'" type="date" v-model="query.value">

<template v-if="isCustomComponent">
<component :value="query.value" @input="updateQuery" :is="rule.component"></component>
<component :value="query.value" @input="updateQuery" :is="rule.component" v-bind="rule.customComponentProps"></component>
</template>

<div class="checkbox" v-if="rule.inputType === 'checkbox'">
Expand Down