Skip to content

Commit

Permalink
Refactor #5426 - For Tree
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Mar 22, 2024
1 parent 7bd88de commit 6ea5aba
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
18 changes: 17 additions & 1 deletion components/lib/tree/Tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
import { VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { InputTextPassThroughOptions } from '../inputtext';
import { PassThroughOptions } from '../passthrough';
import { TreeNode } from '../treenode';
import { ClassComponent, GlobalComponentConstructor, HintedString, PassThrough } from '../ts-helpers';
Expand Down Expand Up @@ -45,6 +46,20 @@ export interface TreePassThroughMethodOptions<T = any> {
global: object | undefined;
}

/**
* Custom shared passthrough(pt) option method.
*/
export interface TreeSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: TreeProps;
/**
* Defines current inline state.
*/
state: TreeState;
}

/**
* Custom expanded keys metadata.
*/
Expand Down Expand Up @@ -95,8 +110,9 @@ export interface TreePassThroughOptions<T = any> {
filterContainer?: TreePassThroughOptionType<T>;
/**
* Used to pass attributes to the input's DOM element.
* @see {@link InputTextPassThroughOptions}
*/
input?: TreePassThroughOptionType<T>;
input?: InputTextPassThroughOptions<TreeSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the search icon's DOM element.
*/
Expand Down
10 changes: 6 additions & 4 deletions components/lib/tree/Tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>
</template>
<div v-if="filter" :class="cx('filterContainer')" v-bind="ptm('filterContainer')">
<input v-model="filterValue" type="text" autocomplete="off" :class="cx('input')" :placeholder="filterPlaceholder" @keydown="onFilterKeydown" v-bind="ptm('input')" />
<InputText v-model="filterValue" autocomplete="off" :class="cx('input')" :placeholder="filterPlaceholder" @keydown="onFilterKeydown" v-bind="ptm('input')" />
<slot name="searchicon" :class="cx('searchIcon')">
<SearchIcon :class="cx('searchIcon')" v-bind="ptm('searchIcon')" />
</slot>
Expand Down Expand Up @@ -41,6 +41,7 @@
<script>
import SearchIcon from 'primevue/icons/search';
import SpinnerIcon from 'primevue/icons/spinner';
import InputText from 'primevue/inputtext';
import { ObjectUtils } from 'primevue/utils';
import BaseTree from './BaseTree.vue';
import TreeNode from './TreeNode.vue';
Expand Down Expand Up @@ -240,9 +241,10 @@ export default {
}
},
components: {
TreeNode: TreeNode,
SearchIcon: SearchIcon,
SpinnerIcon: SpinnerIcon
TreeNode,
InputText,
SearchIcon,
SpinnerIcon
}
};
</script>
2 changes: 1 addition & 1 deletion components/lib/tree/style/TreeStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const classes = {
loadingOverlay: 'p-tree-loading-overlay p-component-overlay',
loadingIcon: 'p-tree-loading-icon',
filterContainer: 'p-tree-filter-container',
input: 'p-tree-filter p-component',
input: 'p-tree-filter',
searchIcon: 'p-tree-filter-icon',
wrapper: 'p-tree-wrapper',
container: 'p-tree-container',
Expand Down

0 comments on commit 6ea5aba

Please sign in to comment.