Doc update for Listbox

pull/12/head
cagataycivici 2019-05-22 18:20:03 +03:00
parent 602e06ef9a
commit f09990631e
2 changed files with 121 additions and 122 deletions

View File

@ -27,15 +27,15 @@ export default {
props: { props: {
value: null, value: null,
options: Array, options: Array,
optionLabel: null, optionLabel: null,
optionValue: null,
optionDisabled: null,
listStyle: null, listStyle: null,
disabled: Boolean, disabled: Boolean,
dataKey: null, dataKey: null,
multiple: Boolean, multiple: Boolean,
metaKeySelection: Boolean, metaKeySelection: Boolean,
filter: Boolean, filter: Boolean
optionValue: null,
optionDisabled: null
}, },
optionTouched: false, optionTouched: false,
data() { data() {

View File

@ -8,10 +8,11 @@ import Listbox from 'primevue/listbox';
</CodeHighlight> </CodeHighlight>
<h3>Getting Started</h3> <h3>Getting Started</h3>
<p>Listbox requires a value to bind, optionLabel and a collection of options. How to define the options property; Providing an array of arbitrary objects along with the <i>optionLabel</i> property to specify the field name of the option.</p> <p>Listbox requires a value to bind and a collection of arbitrary objects along with the <i>optionLabel</i> property to specify the label property of the option.</p>
<CodeHighlight> <CodeHighlight>
&lt;Listbox v-model=&quot;selectedCity&quot; :options=&quot;cities&quot; optionLabel=&quot;name&quot; /&gt; &lt;Listbox v-model=&quot;selectedCity&quot; :options=&quot;cities&quot; optionLabel=&quot;name&quot; /&gt;
</CodeHighlight> </CodeHighlight>
<CodeHighlight lang="js"> <CodeHighlight lang="js">
data() { data() {
return { return {
@ -36,8 +37,7 @@ data() {
</CodeHighlight> </CodeHighlight>
<h3>Custom Content</h3> <h3>Custom Content</h3>
<p>Label of an option is used as the display text of an item by default, for custom content support define a template where <p>Label of an option is used as the display text of an item by default, for custom content support define an <i>option</i> template that gets the option instance as a parameter.</p>
the local template variable refers to an option in the options collection. </p>
<CodeHighlight> <CodeHighlight>
<template v-pre> <template v-pre>
&lt;Listbox v-model=&quot;selectedCars&quot; :options=&quot;cars&quot; :multiple=&quot;true&quot; :filter=&quot;true&quot; optionLabel=&quot;brand&quot; listStyle=&quot;max-height:250px&quot; style=&quot;width:15em&quot;&gt; &lt;Listbox v-model=&quot;selectedCars&quot; :options=&quot;cars&quot; :multiple=&quot;true&quot; :filter=&quot;true&quot; optionLabel=&quot;brand&quot; listStyle=&quot;max-height:250px&quot; style=&quot;width:15em&quot;&gt;
@ -58,84 +58,85 @@ data() {
</CodeHighlight> </CodeHighlight>
<h3>Properties</h3> <h3>Properties</h3>
<p>Any attribute such as style and class are passed to the main container element. Following are the additional properties to configure the component.</p>
<div class="doc-tablewrapper"> <div class="doc-tablewrapper">
<table class="doc-table"> <table class="doc-table">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Type</th> <th>Type</th>
<th>Default</th> <th>Default</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>value</td> <td>value</td>
<td>object</td> <td>any</td>
<td>null</td> <td>null</td>
<td>Selected value to display.</td> <td>Value of the component.</td>
</tr> </tr>
<tr> <tr>
<td>options</td> <td>options</td>
<td>array</td> <td>array</td>
<td>null</td> <td>null</td>
<td>An array of objects to display as the available options.</td> <td>An array of selectitems to display as the available options.</td>
</tr> </tr>
<tr> <tr>
<td>optionLabel</td> <td>optionLabel</td>
<td>string</td> <td>string</td>
<td>null</td> <td>null</td>
<td>Name of the label field of an option when an arbitrary objects instead of SelectItems are used as options.</td> <td>Property name to use as the label of an option.</td>
</tr> </tr>
<tr> <tr>
<td>listStyle</td> <td>optionValue</td>
<td>string</td> <td>string</td>
<td>null</td> <td>null</td>
<td>Inline style of inner list element.</td> <td>Property name to use as the value of an option, defaults to the option itself when not defined.</td>
</tr> </tr>
<tr> <tr>
<td>disabled</td> <td>optionDisabled</td>
<td>boolean</td> <td>boolean</td>
<td>false</td> <td>null</td>
<td>When specified, disables the component.</td> <td>Property name to use as the disabled flag of an option, defaults to false when not defined.</td>
</tr> </tr>
<tr> <tr>
<td>dataKey</td> <td>listStyle</td>
<td>string</td> <td>string</td>
<td>false</td> <td>null</td>
<td>A property to uniquely match the value in options for better performance.</td> <td>Inline style of inner list element.</td>
</tr> </tr>
<tr> <tr>
<td>multiple</td> <td>disabled</td>
<td>boolean</td> <td>boolean</td>
<td>false</td> <td>false</td>
<td>When specified, allows selecting multiple values.</td> <td>When specified, disables the component.</td>
</tr> </tr>
<tr> <tr>
<td>metaKeySelection</td> <td>dataKey</td>
<td>boolean</td> <td>string</td>
<td>true</td> <td>false</td>
<td>Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item <td>A property to uniquely match the value in options for better performance.</td>
can be toggled individually. On touch enabled devices, metaKeySelection is turned off automatically.</td> </tr>
</tr> <tr>
<tr> <td>multiple</td>
<td>filter</td> <td>boolean</td>
<td>boolean</td> <td>false</td>
<td>false</td> <td>When specified, allows selecting multiple values.</td>
<td>When specified, displays a filter input at header.</td> </tr>
</tr> <tr>
<tr> <td>metaKeySelection</td>
<td>optionValue</td> <td>boolean</td>
<td>???</td> <td>true</td>
<td>null</td> <td>Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item
<td>???</td> can be toggled individually. On touch enabled devices, metaKeySelection is turned off automatically.</td>
</tr> </tr>
<tr> <tr>
<td>optionDisabled</td> <td>filter</td>
<td>boolean</td> <td>boolean</td>
<td>null</td> <td>false</td>
<td>???</td> <td>When specified, displays a filter input at header.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -144,26 +145,24 @@ data() {
<div class="doc-tablewrapper"> <div class="doc-tablewrapper">
<table class="doc-table"> <table class="doc-table">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Parameters</th> <th>Parameters</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>change</td> <td>change</td>
<td>event.originalEvent: Browser event <br/> <td>event.originalEvent: Original event <br />
event.value: Single value or an array of values depending on the selection mode <br/> event.value: Selected option value </td>
</td> <td>Callback to invoke on value change.</td>
<td>Callback to invoke when value of listbox changes.</td> </tr>
</tr> <tr>
<tr> <td>input</td>
<td>input</td> <td>value: New value</td>
<td>event: Single value or an array of values depending on the selection mode <br/> <td>Callback to invoke on value change.</td>
</td> </tr>
<td>Callback to invoke when value of listbox changes.</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -173,32 +172,32 @@ data() {
<div class="doc-tablewrapper"> <div class="doc-tablewrapper">
<table class="doc-table"> <table class="doc-table">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Element</th> <th>Element</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>p-listbox</td> <td>p-listbox</td>
<td>Main container element.</td> <td>Main container element.</td>
</tr> </tr>
<tr> <tr>
<td>p-listbox-header</td> <td>p-listbox-header</td>
<td>Header element.</td> <td>Header element.</td>
</tr> </tr>
<tr> <tr>
<td>p-listbox-list-wrapper</td> <td>p-listbox-list-wrapper</td>
<td>Container of list element.</td> <td>Container of list element.</td>
</tr> </tr>
<tr> <tr>
<td>p-listbox-list</td> <td>p-listbox-list</td>
<td>List element.</td> <td>List element.</td>
</tr> </tr>
<tr> <tr>
<td>p-listbox-item</td> <td>p-listbox-item</td>
<td>An item in the list element.</td> <td>An item in the list element.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>