From 4c9a2d56fbdc288e3f9b6a5f2394bd6c69ae4bce Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 28 Oct 2024 14:30:12 +0300 Subject: [PATCH] Fixed #6654 - For TreeSelect --- .../src/treeselect/BaseTreeSelect.vue | 8 +++++++ .../primevue/src/treeselect/TreeSelect.d.ts | 24 +++++++++++++++++++ .../primevue/src/treeselect/TreeSelect.vue | 21 ++++++++++++---- .../src/treeselect/style/TreeSelectStyle.d.ts | 4 ++++ .../src/treeselect/style/TreeSelectStyle.js | 9 +++++++ 5 files changed, 62 insertions(+), 4 deletions(-) diff --git a/packages/primevue/src/treeselect/BaseTreeSelect.vue b/packages/primevue/src/treeselect/BaseTreeSelect.vue index f5ab6370a..b73cc1663 100644 --- a/packages/primevue/src/treeselect/BaseTreeSelect.vue +++ b/packages/primevue/src/treeselect/BaseTreeSelect.vue @@ -51,6 +51,14 @@ export default { type: String, default: 'mask' }, + showClear: { + type: Boolean, + default: false + }, + clearIcon: { + type: String, + default: undefined + }, filter: { type: Boolean, default: false diff --git a/packages/primevue/src/treeselect/TreeSelect.d.ts b/packages/primevue/src/treeselect/TreeSelect.d.ts index 6c3d6154c..17a34865c 100644 --- a/packages/primevue/src/treeselect/TreeSelect.d.ts +++ b/packages/primevue/src/treeselect/TreeSelect.d.ts @@ -80,6 +80,10 @@ export interface TreeSelectPassThroughOptions { * Used to pass attributes to the label's DOM element. */ label?: TreeSelectPassThroughOptionType; + /** + * Used to pass attributes to the clear icon's DOM element. + */ + clearIcon?: TreeSelectPassThroughOptionType; /** * Used to pass attributes to the chip's DOM element. */ @@ -189,6 +193,15 @@ export interface TreeSelectProps { * A map of keys to represent the expansion state in controlled mode. */ expandedKeys?: TreeExpandedKeys; + /** + * When enabled, a clear icon is displayed to clear the value. + * @defaultValue false + */ + showClear?: boolean | undefined; + /** + * Icon to display in clear button. + */ + clearIcon?: string | undefined; /** * Height of the viewport, a scrollbar is defined if height of list exceeds this value. * @defaultValue 20rem @@ -473,6 +486,17 @@ export interface TreeSelectSlots { */ partialChecked: boolean; }): VNode[]; + /** + * Custom clear icon template. + * @param {Object} scope - clear icon slot's params. + */ + clearicon(scope: { + /** + * Clear icon click function. + * @param {Event} event - Browser event + */ + clearCallback: (event: Event) => void; + }): VNode[]; } /** diff --git a/packages/primevue/src/treeselect/TreeSelect.vue b/packages/primevue/src/treeselect/TreeSelect.vue index ec7183fe4..8e1a3dcb9 100644 --- a/packages/primevue/src/treeselect/TreeSelect.vue +++ b/packages/primevue/src/treeselect/TreeSelect.vue @@ -37,6 +37,9 @@ + + +
@@ -121,7 +124,7 @@