@ -10,7 +10,7 @@ import {
VerticalAdaptLayout ,
VerticalAdaptLayout ,
deepClone ,
deepClone ,
Selection ,
Selection ,
SIZE _CONSANTS
size
} from "@/core" ;
} from "@/core" ;
import { Single , Combo } from "@/base" ;
import { Single , Combo } from "@/base" ;
import { MultiTreeSearcher } from "./trigger/searcher.multi.tree" ;
import { MultiTreeSearcher } from "./trigger/searcher.multi.tree" ;
@ -27,12 +27,14 @@ export class MultiTreeCombo extends Single {
static EVENT _FOCUS = "EVENT_FOCUS" ;
static EVENT _FOCUS = "EVENT_FOCUS" ;
static EVENT _BLUR = "EVENT_BLUR" ;
static EVENT _BLUR = "EVENT_BLUR" ;
static EVENT _START = "EVENT_START" ;
static EVENT _STOP = "EVENT_STOP" ;
static EVENT _STOP = "EVENT_STOP" ;
static EVENT _SEARCHING = "EVENT_SEARCHING" ;
static EVENT _SEARCHING = "EVENT_SEARCHING" ;
static EVENT _CLICK _ITEM = "EVENT_CLICK_ITEM" ;
static EVENT _CLICK _ITEM = "EVENT_CLICK_ITEM" ;
static EVENT _CONFIRM = "EVENT_CONFIRM" ;
static EVENT _CONFIRM = "EVENT_CONFIRM" ;
static EVENT _BEFORE _POPUPVIEW = "EVENT_BEFORE_POPUPVIEW" ;
static EVENT _BEFORE _POPUPVIEW = "EVENT_BEFORE_POPUPVIEW" ;
static EVENT _AFTER _HIDEVIEW = "EVENT_AFTER_HIDEVIEW" ;
static EVENT _AFTER _HIDEVIEW = "EVENT_AFTER_HIDEVIEW" ;
static EVENT _BEFORE _NUMBER _COUNTER _POPUPVIEW = "EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW" ;
_defaultConfig ( ) {
_defaultConfig ( ) {
return extend ( super . _defaultConfig ( ... arguments ) , {
return extend ( super . _defaultConfig ( ... arguments ) , {
@ -42,6 +44,8 @@ export class MultiTreeCombo extends Single {
height : 24 ,
height : 24 ,
allowEdit : true ,
allowEdit : true ,
isNeedAdjustWidth : true ,
isNeedAdjustWidth : true ,
popup : { } ,
masker : { } ,
} ) ;
} ) ;
}
}
@ -63,23 +67,20 @@ export class MultiTreeCombo extends Single {
this . storeValue = { value : o . value || { } } ;
this . storeValue = { value : o . value || { } } ;
this . trigger = createWidget ( {
this . trigger = createWidget ( {
type : "bi.multi_select_trigger" ,
type : MultiSelectTrigger . xtype ,
popup : o . popup ,
masker : o . masker ,
allowEdit : o . allowEdit ,
allowEdit : o . allowEdit ,
height : toPix ( o . height , o . simple ? 1 : 2 ) ,
height : toPix ( o . height , o . simple ? 1 : 2 ) ,
valueFormatter : o . valueFormatter ,
valueFormatter : o . valueFormatter ,
text : o . text ,
text : o . text ,
defaultText : o . defaultText ,
defaultText : o . defaultText ,
watermark : o . watermark ,
watermark : o . watermark ,
masker : {
adapter : ( ) => {
offset : {
return this . popup . getView ( ) ;
left : 0 ,
top : 0 ,
right : 0 ,
bottom : SIZE _CONSANTS . LIST _ITEM _HEIGHT + 1 ,
} ,
} ,
} ,
searcher : {
searcher : {
type : "bi.multi_tree_searcher" ,
type : MultiTreeSearcher . xtype ,
itemsCreator : o . itemsCreator ,
itemsCreator : o . itemsCreator ,
listeners : [
listeners : [
{
{
@ -104,8 +105,6 @@ export class MultiTreeCombo extends Single {
type : MultiTreePopup . xtype ,
type : MultiTreePopup . xtype ,
ref ( ) {
ref ( ) {
self . popup = this ;
self . popup = this ;
self . trigger . setAdapter ( this ) ;
self . numberCounter . setAdapter ( this ) ;
} ,
} ,
listeners : [
listeners : [
{
{
@ -160,13 +159,16 @@ export class MultiTreeCombo extends Single {
} ) ;
} ) ;
} ,
} ,
maxWidth : o . isNeedAdjustWidth ? "auto" : 500 ,
maxWidth : o . isNeedAdjustWidth ? "auto" : 500 ,
... o . popup ,
} ,
} ,
isNeedAdjustWidth : o . isNeedAdjustWidth ,
isNeedAdjustWidth : o . isNeedAdjustWidth ,
value : { value : o . value || { } } ,
value : { value : o . value || { } } ,
hideChecker ( e ) {
hideChecker ( e ) {
return (
return (
triggerBtn . element . find ( e . target ) . length === 0 &&
triggerBtn . element . find ( e . target ) . length === 0 &&
self . numberCounter . element . find ( e . target ) . length === 0
size ( self . numberCounter . getView ( ) ? . element . find ( e . target ) ) === 0 &&
size ( self . trigger . getSearcher ( ) . getSearcher ( ) . getView ( ) ? . element . find ( e . target ) ) === 0 &&
self . trigger . getSearcher ( ) . getSearcher ( ) . getView ( ) ? . element [ 0 ] !== e . target
) ;
) ;
} ,
} ,
} ) ;
} ) ;
@ -193,6 +195,7 @@ export class MultiTreeCombo extends Single {
self . storeValue = { value : self . combo . getValue ( ) } ;
self . storeValue = { value : self . combo . getValue ( ) } ;
this . setValue ( self . storeValue ) ;
this . setValue ( self . storeValue ) ;
self . numberCounter . setValue ( self . storeValue ) ;
self . numberCounter . setValue ( self . storeValue ) ;
self . fireEvent ( MultiTreeCombo . EVENT _START ) ;
} ) ;
} ) ;
this . trigger . on ( MultiSelectTrigger . EVENT _STOP , function ( ) {
this . trigger . on ( MultiSelectTrigger . EVENT _STOP , function ( ) {
self . storeValue = { value : this . getValue ( ) } ;
self . storeValue = { value : this . getValue ( ) } ;
@ -295,23 +298,18 @@ export class MultiTreeCombo extends Single {
} ) ;
} ) ;
this . numberCounter = createWidget ( {
this . numberCounter = createWidget ( {
type : "bi.multi_select_check_selected_switcher" ,
type : MultiSelectCheckSelectedSwitcher ,
el : {
el : {
// type: "bi.multi_tree_check_selected_button",
type : MultiTreeCheckSelectedButton . xtype ,
type : MultiTreeCheckSelectedButton . xtype ,
} ,
} ,
popup : {
popup : {
// type: "bi.multi_tree_check_pane",
type : MultiTreeCheckPane . xtype ,
type : MultiTreeCheckPane . xtype ,
... o . popup ,
} ,
} ,
masker : {
adapter : ( ) => {
offset : {
return this . popup . getView ( ) ;
left : 0 ,
top : 0 ,
right : 0 ,
bottom : SIZE _CONSANTS . LIST _ITEM _HEIGHT + 1 ,
} ,
} ,
} ,
masker : o . masker ,
itemsCreator : o . itemsCreator ,
itemsCreator : o . itemsCreator ,
valueFormatter : o . valueFormatter ,
valueFormatter : o . valueFormatter ,
value : { value : o . value || { } } ,
value : { value : o . value || { } } ,
@ -334,6 +332,7 @@ export class MultiTreeCombo extends Single {
want2showCounter = null ;
want2showCounter = null ;
showCounter ( ) ;
showCounter ( ) ;
}
}
this . fireEvent ( MultiTreeCombo . EVENT _BEFORE _NUMBER _COUNTER _POPUPVIEW ) ;
}
}
) ;
) ;
@ -443,4 +442,16 @@ export class MultiTreeCombo extends Single {
setWaterMark ( v ) {
setWaterMark ( v ) {
this . trigger . setWaterMark ( v ) ;
this . trigger . setWaterMark ( v ) ;
}
}
getPopup ( ) {
return this . popup ;
}
getNumberCounter ( ) {
return this . numberCounter ;
}
getTrigger ( ) {
return this . trigger ;
}
}
}