Refactor #6481- Tree lazy

pull/6483/head
tugcekucukoglu 2024-09-26 12:31:12 +03:00
parent cb124df402
commit 06d3393ffc
4 changed files with 34 additions and 3 deletions

View File

@ -56,6 +56,18 @@ export default {
type: Boolean, type: Boolean,
default: null default: null
}, },
loading: {
type: Boolean,
default: false
},
loadingIcon: {
type: String,
default: undefined
},
loadingMode: {
type: String,
default: 'mask'
},
filter: { filter: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -230,6 +230,20 @@ export interface TreeSelectProps {
* @defaultValue false * @defaultValue false
*/ */
metaKeySelection?: boolean | undefined; metaKeySelection?: boolean | undefined;
/**
* Whether to display loading indicator.
* @defaultValue false
*/
loading?: boolean | undefined;
/**
* Icon to display when tree is loading.
*/
loadingIcon?: string | undefined;
/**
* Loading mode display.
* @defaultValue mask
*/
loadingMode?: 'mask' | 'icon' | undefined;
/** /**
* When specified, displays an input field to filter the items. * When specified, displays an input field to filter the items.
* @defaultValue false * @defaultValue false

View File

@ -49,7 +49,6 @@
<span <span
ref="firstHiddenFocusableElementOnOverlay" ref="firstHiddenFocusableElementOnOverlay"
role="presentation" role="presentation"
aria-hidden="true"
class="p-hidden-accessible p-hidden-focusable" class="p-hidden-accessible p-hidden-focusable"
:tabindex="0" :tabindex="0"
@focus="onFirstHiddenFocus" @focus="onFirstHiddenFocus"
@ -64,6 +63,9 @@
:id="listId" :id="listId"
:value="options" :value="options"
:selectionMode="selectionMode" :selectionMode="selectionMode"
:loading="loading"
:loadingIcon="loadingIcon"
:loadingMode="loadingMode"
:filter="filter" :filter="filter"
:filterBy="filterBy" :filterBy="filterBy"
:filterMode="filterMode" :filterMode="filterMode"
@ -93,7 +95,7 @@
<slot name="itemcheckboxicon" :checked="iconProps.checked" :partialChecked="iconProps.partialChecked" :class="iconProps.class" /> <slot name="itemcheckboxicon" :checked="iconProps.checked" :partialChecked="iconProps.partialChecked" :class="iconProps.class" />
</template> </template>
</TSTree> </TSTree>
<div v-if="emptyOptions" :class="cx('emptyMessage')" v-bind="ptm('emptyMessage')"> <div v-if="emptyOptions && !loading" :class="cx('emptyMessage')" v-bind="ptm('emptyMessage')">
<slot name="empty">{{ emptyMessageText }}</slot> <slot name="empty">{{ emptyMessageText }}</slot>
</div> </div>
</div> </div>
@ -101,7 +103,6 @@
<span <span
ref="lastHiddenFocusableElementOnOverlay" ref="lastHiddenFocusableElementOnOverlay"
role="presentation" role="presentation"
aria-hidden="true"
class="p-hidden-accessible p-hidden-focusable" class="p-hidden-accessible p-hidden-focusable"
:tabindex="0" :tabindex="0"
@focus="onLastHiddenFocus" @focus="onLastHiddenFocus"

View File

@ -121,6 +121,10 @@ const theme = ({ dt }) => `
padding: ${dt('treeselect.tree.padding')}; padding: ${dt('treeselect.tree.padding')};
} }
.p-treeselect-overlay .p-tree-loading {
min-height: 3rem;
}
.p-treeselect-label .p-chip { .p-treeselect-label .p-chip {
padding-top: calc(${dt('treeselect.padding.y')} / 2); padding-top: calc(${dt('treeselect.padding.y')} / 2);
padding-bottom: calc(${dt('treeselect.padding.y')} / 2); padding-bottom: calc(${dt('treeselect.padding.y')} / 2);