New stripedRows prop for PickList

pull/2157/head
Tuğçe Küçükoğlu 2022-02-14 14:36:29 +03:00 committed by Tuğçe Küçükoğlu
parent 838be3bb87
commit 4e4870be63
6 changed files with 34 additions and 3 deletions

View File

@ -40,6 +40,12 @@ const OrderListProps = [
type: "string", type: "string",
default: "960px", default: "960px",
description: "The breakpoint to define the maximum width boundary when responsiveness is enabled." description: "The breakpoint to define the maximum width boundary when responsiveness is enabled."
},
{
name: "stripedRows",
type: "boolean",
default: "false",
description: "Whether to displays rows with alternating colors."
} }
]; ];

View File

@ -40,6 +40,12 @@ const PickListProps = [
type: "string", type: "string",
default: "960px", default: "960px",
description: "The breakpoint to define the maximum width boundary when responsiveness is enabled." description: "The breakpoint to define the maximum width boundary when responsiveness is enabled."
},
{
name: "stripedRows",
type: "boolean",
default: "false",
description: "Whether to displays rows with alternating colors."
} }
]; ];

View File

@ -52,7 +52,7 @@ export interface PickListMoveAllToTargetEvent extends PickListMoveToTargetEvent
*/ */
export interface PickListMoveToSourceEvent extends PickListMoveToTargetEvent { } export interface PickListMoveToSourceEvent extends PickListMoveToTargetEvent { }
/** /**
* @extends PickListMoveToTargetEvent * @extends PickListMoveToTargetEvent
*/ */
export interface PickListMoveAllToSourceEvent extends PickListMoveToTargetEvent { } export interface PickListMoveAllToSourceEvent extends PickListMoveToTargetEvent { }
@ -91,6 +91,10 @@ export interface PickListProps {
* Default value is '960px'. * Default value is '960px'.
*/ */
breakpoint?: string | undefined; breakpoint?: string | undefined;
/**
* Whether to displays rows with alternating colors.
*/
stripedRows?: boolean | undefined;
} }
export interface PickListSlots { export interface PickListSlots {

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="p-picklist p-component"> <div :class="containerClass">
<div class="p-picklist-buttons p-picklist-source-controls"> <div class="p-picklist-buttons p-picklist-source-controls">
<slot name="sourcecontrolsstart"></slot> <slot name="sourcecontrolsstart"></slot>
<PLButton type="button" icon="pi pi-angle-up" @click="moveUp($event, 0)"></PLButton> <PLButton type="button" icon="pi pi-angle-up" @click="moveUp($event, 0)"></PLButton>
@ -91,6 +91,10 @@ export default {
breakpoint: { breakpoint: {
type: String, type: String,
default: '960px' default: '960px'
},
stripedRows: {
type: Boolean,
default: false
} }
}, },
itemTouched: false, itemTouched: false,
@ -552,6 +556,11 @@ export default {
} }
}, },
computed: { computed: {
containerClass() {
return ['p-picklist p-component', {
'p-picklist-striped': this.stripedRows
}];
},
sourceList() { sourceList() {
return this.modelValue && this.modelValue[0] ? this.modelValue[0] : null; return this.modelValue && this.modelValue[0] ? this.modelValue[0] : null;
}, },

View File

@ -10,7 +10,7 @@
<div class="content-section implementation"> <div class="content-section implementation">
<div class="card"> <div class="card">
<OrderList v-model="products" listStyle="height:auto" dataKey="id" stripedRows> <OrderList v-model="products" listStyle="height:auto" dataKey="id">
<template #header> <template #header>
List of Products List of Products
</template> </template>

View File

@ -136,6 +136,12 @@ import PickList from 'primevue/picklist';
<td>string</td> <td>string</td>
<td>960px</td> <td>960px</td>
<td>The breakpoint to define the maximum width boundary when responsiveness is enabled.</td> <td>The breakpoint to define the maximum width boundary when responsiveness is enabled.</td>
</tr>
<tr>
<td>stripedRows</td>
<td>boolean</td>
<td>false</td>
<td>Whether to displays rows with alternating colors.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>