@ -1,3 +1,6 @@
import { MultiListTreeSearcher } from "./trigger/searcher.list.multi.tree" ;
import { MultiTreeCheckSelectedButton } from "./trigger/multi.tree.button.checkselected" ;
import { MultiTreeCheckPane } from "./check/multi.tree.check.pane" ;
import {
shortcut ,
extend ,
@ -14,12 +17,7 @@ import { Single, Combo } from "@/base";
import { MultiTreeSearchInsertPane } from "./trigger/multi.tree.search.insert.pane" ;
import { MultiTreePopup } from "./multi.tree.popup" ;
import { MultiSelectTrigger } from "../multiselect/multiselect.trigger" ;
import {
TriggerIconButton ,
ListPartTree ,
ListDisplayTree ,
Listasynctree
} from "@/case" ;
import { TriggerIconButton , ListPartTree , ListDisplayTree , Listasynctree } from "@/case" ;
import { MultiSelectCheckSelectedSwitcher } from "../multiselect/trigger/switcher.checkselected" ;
@ shortcut ( )
@ -57,7 +55,7 @@ export class MultiTreeListCombo extends Single {
this . storeValue = { value : o . value || [ ] } ;
this . trigger = createWidget ( {
type : "bi.multi_select_trigger" ,
type : MultiSelectTrigger . xtype ,
allowEdit : o . allowEdit ,
text : o . text ,
defaultText : o . defaultText ,
@ -73,12 +71,10 @@ export class MultiTreeListCombo extends Single {
} ,
} ,
searcher : {
type : "bi.multi_list_tree_searcher" ,
type : MultiListTreeSearcher . xtype ,
itemsCreator : o . itemsCreator ,
popup : {
type : o . allowInsertValue
? "bi.multi_tree_search_insert_pane"
: "bi.multi_tree_search_pane" ,
type : o . allowInsertValue ? "bi.multi_tree_search_insert_pane" : "bi.multi_tree_search_pane" ,
el : {
type : ListPartTree . xtype ,
} ,
@ -86,9 +82,7 @@ export class MultiTreeListCombo extends Single {
{
eventName : MultiTreeSearchInsertPane . EVENT _ADD _ITEM ,
action ( ) {
self . storeValue . value . unshift ( [
self . trigger . getSearcher ( ) . getKeyword ( )
] ) ;
self . storeValue . value . unshift ( [ self . trigger . getSearcher ( ) . getKeyword ( ) ] ) ;
self . _assertShowValue ( ) ;
// setValue以更新paras.value, 之后从search popup中拿到的就能有add的值了
self . combo . setValue ( self . storeValue ) ;
@ -102,10 +96,10 @@ export class MultiTreeListCombo extends Single {
} ,
switcher : {
el : {
type : "bi.multi_tree_check_selected_button" ,
type : MultiTreeCheckSelectedButton . xtype ,
} ,
popup : {
type : "bi.multi_tree_check_pane" ,
type : MultiTreeCheckPane . xtype ,
el : {
type : ListDisplayTree . xtype ,
} ,
@ -154,10 +148,7 @@ export class MultiTreeListCombo extends Single {
self . trigger . getSearcher ( ) . setState ( val ) ;
self . numberCounter . setButtonChecked ( val ) ;
self . storeValue = { value : self . combo . getValue ( ) } ;
self . fireEvent (
MultiTreeListCombo . EVENT _CLICK _ITEM ,
self . getValue ( )
) ;
self . fireEvent ( MultiTreeListCombo . EVENT _CLICK _ITEM , self . getValue ( ) ) ;
self . _dataChange = true ;
} ,
} ,
@ -196,16 +187,12 @@ export class MultiTreeListCombo extends Single {
} ,
} ) ;
var change = false ;
var clear = false ; // 标识当前是否点击了清空
let change = false ;
let clear = false ; // 标识当前是否点击了清空
const isSearching = function ( ) {
return self . trigger . getSearcher ( ) . isSearching ( ) ;
} ;
const isSearching = ( ) => self . trigger . getSearcher ( ) . isSearching ( ) ;
const isPopupView = function ( ) {
return self . combo . isViewVisible ( ) ;
} ;
const isPopupView = ( ) => self . combo . isViewVisible ( ) ;
this . trigger . on ( MultiSelectTrigger . EVENT _FOCUS , ( ) => {
self . fireEvent ( MultiTreeListCombo . EVENT _FOCUS ) ;
@ -255,14 +242,9 @@ export class MultiTreeListCombo extends Single {
type : BI . Selection . Multi ,
value : checked ? { 1 : 1 } : { } ,
} ;
this . getSearcher ( ) . setState (
checked ? BI . Selection . Multi : BI . Selection . None
) ;
this . getSearcher ( ) . setState ( checked ? BI . Selection . Multi : BI . Selection . None ) ;
self . numberCounter . setButtonChecked ( val ) ;
self . fireEvent (
MultiTreeListCombo . EVENT _CLICK _ITEM ,
self . combo . getValue ( )
) ;
self . fireEvent ( MultiTreeListCombo . EVENT _CLICK _ITEM , self . combo . getValue ( ) ) ;
self . _dataChange = true ;
} ) ;
@ -285,8 +267,7 @@ export class MultiTreeListCombo extends Single {
this . combo . on ( Combo . EVENT _BEFORE _HIDEVIEW , ( ) => {
if ( isSearching ( ) ) {
self . trigger . stopEditing ( ) ;
self . _dataChange &&
self . fireEvent ( MultiTreeListCombo . EVENT _CONFIRM ) ;
self . _dataChange && self . fireEvent ( MultiTreeListCombo . EVENT _CONFIRM ) ;
} else {
if ( isPopupView ( ) ) {
self . _stopEditing ( ) ;
@ -294,15 +275,14 @@ export class MultiTreeListCombo extends Single {
if ( clear === true ) {
self . storeValue = { value : [ ] } ;
}
self . _dataChange &&
self . fireEvent ( MultiTreeListCombo . EVENT _CONFIRM ) ;
self . _dataChange && self . fireEvent ( MultiTreeListCombo . EVENT _CONFIRM ) ;
}
}
clear = false ;
change = false ;
} ) ;
var triggerBtn = createWidget ( {
const triggerBtn = createWidget ( {
type : TriggerIconButton . xtype ,
width : o . height ,
height : o . height ,
@ -318,12 +298,12 @@ export class MultiTreeListCombo extends Single {
} ) ;
this . numberCounter = createWidget ( {
type : "bi.multi_select_check_selected_switcher" ,
type : MultiSelectCheckSelectedSwitcher . xtype ,
el : {
type : "bi.multi_tree_check_selected_button" ,
type : MultiTreeCheckSelectedButton . xtype ,
} ,
popup : {
type : "bi.multi_tree_check_pane" ,
type : MultiTreeCheckPane . xtype ,
} ,
itemsCreator : o . itemsCreator ,
masker : {
@ -337,17 +317,12 @@ export class MultiTreeListCombo extends Single {
valueFormatter : o . valueFormatter ,
value : o . value ,
} ) ;
this . numberCounter . on (
MultiSelectCheckSelectedSwitcher . EVENT _TRIGGER _CHANGE ,
( ) => {
this . numberCounter . on ( MultiSelectCheckSelectedSwitcher . EVENT _TRIGGER _CHANGE , ( ) => {
if ( ! self . combo . isViewVisible ( ) ) {
self . combo . showView ( ) ;
}
}
) ;
this . numberCounter . on (
MultiSelectCheckSelectedSwitcher . EVENT _BEFORE _POPUPVIEW ,
( ) => {
} ) ;
this . numberCounter . on ( MultiSelectCheckSelectedSwitcher . EVENT _BEFORE _POPUPVIEW , ( ) => {
if ( want2showCounter === false ) {
want2showCounter = true ;
}
@ -355,27 +330,21 @@ export class MultiTreeListCombo extends Single {
want2showCounter = null ;
showCounter ( ) ;
}
}
) ;
} ) ;
this . numberCounter . on ( Events . VIEW , b => {
nextTick ( ( ) => {
// 自动调整宽度
self . trigger . refreshPlaceHolderWidth (
b === true ? self . numberCounter . element . outerWidth ( ) + 8 : 0
) ;
self . trigger . refreshPlaceHolderWidth ( b === true ? self . numberCounter . element . outerWidth ( ) + 8 : 0 ) ;
} ) ;
} ) ;
this . numberCounter . on (
MultiSelectCheckSelectedSwitcher . EVENT _AFTER _HIDEVIEW ,
( ) => {
this . numberCounter . on ( MultiSelectCheckSelectedSwitcher . EVENT _AFTER _HIDEVIEW , ( ) => {
nextTick ( ( ) => {
// 收起时自动调整宽度
self . trigger . refreshPlaceHolderWidth ( 0 ) ;
} ) ;
}
) ;
} ) ;
this . trigger . element . click ( e => {
if ( self . trigger . element . find ( e . target ) . length > 0 ) {