From 3c68ccc1b16dec99b97af4cc6147a365da43a69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Thu, 13 Jul 2023 10:42:00 +0300 Subject: [PATCH] Refactor #4124 - PickList pt context improvements --- components/lib/picklist/BasePickList.vue | 9 ++++- components/lib/picklist/PickList.d.ts | 8 +++++ components/lib/picklist/PickList.vue | 42 ++++++++++++------------ 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/components/lib/picklist/BasePickList.vue b/components/lib/picklist/BasePickList.vue index e032bf051..37eaad275 100644 --- a/components/lib/picklist/BasePickList.vue +++ b/components/lib/picklist/BasePickList.vue @@ -49,7 +49,7 @@ const classes = { sourceWrapper: 'p-picklist-list-wrapper p-picklist-source-wrapper', sourceHeader: 'p-picklist-header', sourceList: 'p-picklist-list p-picklist-source-list', - item: ({ instance, item, id, listIndex }) => [ + sourceItem: ({ instance, item, id, listIndex }) => [ 'p-picklist-item', { 'p-highlight': instance.isSelected(item, listIndex), @@ -60,6 +60,13 @@ const classes = { targetWrapper: 'p-picklist-list-wrapper p-picklist-target-wrapper', targetHeader: 'p-picklist-header', targetList: 'p-picklist-list p-picklist-target', + targetItem: ({ instance, item, id, listIndex }) => [ + 'p-picklist-item', + { + 'p-highlight': instance.isSelected(item, listIndex), + 'p-focus': id === instance.focusedOptionId + } + ], targetControls: 'p-picklist-buttons p-picklist-target-controls' }; diff --git a/components/lib/picklist/PickList.d.ts b/components/lib/picklist/PickList.d.ts index b8267c8b4..92e61ae90 100755 --- a/components/lib/picklist/PickList.d.ts +++ b/components/lib/picklist/PickList.d.ts @@ -138,6 +138,10 @@ export interface PickListPassThroughOptions { * Uses to pass attributes to the source list's DOM element. */ sourceList?: PickListPassThroughOptionType; + /** + * Uses to pass attributes to the source item's DOM element. + */ + sourceItem?: PickListPassThroughOptionType; /** * Uses to pass attributes to the buttons' DOM element. */ @@ -170,6 +174,10 @@ export interface PickListPassThroughOptions { * Uses to pass attributes to the target list's DOM element. */ targetList?: PickListPassThroughOptionType; + /** + * Uses to pass attributes to the target item's DOM element. + */ + targetItem?: PickListPassThroughOptionType; /** * Uses to pass attributes to the target controls' DOM element. */ diff --git a/components/lib/picklist/PickList.vue b/components/lib/picklist/PickList.vue index c45d0c670..9ea41da58 100755 --- a/components/lib/picklist/PickList.vue +++ b/components/lib/picklist/PickList.vue @@ -2,28 +2,28 @@
- + - + - + - +