mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
do not return folders, if leafOnly is set and some more docu
This commit is contained in:
parent
3e577c738f
commit
c18be4cf4d
@ -1366,7 +1366,9 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
|
||||
*/
|
||||
protected searchMatch(search : string, option : SelectOption) : boolean
|
||||
{
|
||||
if(!option || !option.value)
|
||||
if(!option || !option.value ||
|
||||
// do NOT return folders, if leafOnly is set
|
||||
this.leafOnly && typeof option.children === 'undefined')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -97,7 +97,10 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin
|
||||
openIcon: String;
|
||||
@property({type: Function})
|
||||
onclick;// description: "JS code which gets executed when clicks on text of a node"
|
||||
@property({type:String})
|
||||
/**
|
||||
* If true, only leafs (NOT folders) are selectable
|
||||
*/
|
||||
@property({type:Boolean})
|
||||
leafOnly = false
|
||||
|
||||
|
||||
|
@ -47,7 +47,6 @@ type Constructor<T = {}> = new (...args : any[]) => T;
|
||||
|
||||
export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidgetInterface & typeof LitElement, TreeSearchResult, TreeSearchResults>(Et2WidgetWithSelectMixin(LitElement))
|
||||
{
|
||||
|
||||
static get styles()
|
||||
{
|
||||
return [
|
||||
@ -65,8 +64,9 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
||||
/** The component's help text. If you need to display HTML, use the `help-text` slot instead. */
|
||||
@property({attribute: 'help-text'}) helpText = "";
|
||||
|
||||
/** "JSON URL or menuaction to be called for nodes marked with child=1, but not having children, getSelectedNode() contains node-id" */
|
||||
@property({type: String})
|
||||
autoloading: string = "" //description: "JSON URL or menuaction to be called for nodes marked with child=1, but not having children, getSelectedNode() contains node-id"
|
||||
autoloading: string = "";
|
||||
|
||||
/**
|
||||
* Indicates whether the dropdown is open. You can toggle this attribute to show and hide the tree, or you can
|
||||
@ -80,6 +80,9 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
||||
*/
|
||||
@property({type: Object}) actions = {};
|
||||
|
||||
/**
|
||||
* If true, only leafs (NOT folders) are selectable
|
||||
*/
|
||||
@property()
|
||||
set leafOnly(_leafOnly: boolean)
|
||||
{
|
||||
@ -94,6 +97,10 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
||||
}
|
||||
)
|
||||
}
|
||||
get leafOnly()
|
||||
{
|
||||
return this._tree?.leafOnly;
|
||||
}
|
||||
|
||||
@state() currentTag: Et2Tag;
|
||||
|
||||
|
@ -297,7 +297,9 @@ export const SearchMixin = <T extends Constructor<Et2InputWidgetInterface &
|
||||
*/
|
||||
public searchMatch<DataType extends SearchResult>(search : string, searchOptions : Object, option : DataType) : boolean
|
||||
{
|
||||
if(!option || !option.value)
|
||||
if(!option || !option.value ||
|
||||
// do NOT return folders, if leafOnly is set
|
||||
this.leafOnly && typeof option.children !== 'undefined')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user