@@ -695,6 +695,85 @@ sap.ui.define("z2ui5/MultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap
695695}
696696) ;
697697
698+ sap . ui . define ( "z2ui5/SmartMultiInputExt" , [ "sap/ui/core/Control" , "sap/m/Token" , "sap/ui/core/Core" , "sap/ui/core/Element" ] , ( Control ) => {
699+ "use strict" ;
700+
701+ return Control . extend ( "z2ui5.SmartMultiInputExt" , {
702+ metadata : {
703+ properties : {
704+ multiInputId : {
705+ type : "String"
706+ } ,
707+ addedTokens : {
708+ type : "Array"
709+ } ,
710+ removedTokens : {
711+ type : "Array"
712+ } ,
713+ rangeData : {
714+ type : "Array"
715+ } ,
716+ checkInit : {
717+ type : "Boolean" ,
718+ defaultValue : false
719+ }
720+ } ,
721+ events : {
722+ "change" : {
723+ allowPreventDefault : true ,
724+ parameters : { }
725+ }
726+ } ,
727+ } ,
728+
729+ init ( ) {
730+ z2ui5 . onAfterRendering . push ( this . setControl . bind ( this ) ) ;
731+ } ,
732+
733+ onTokenUpdate ( oEvent ) {
734+ this . setProperty ( "addedTokens" , [ ] ) ;
735+ this . setProperty ( "removedTokens" , [ ] ) ;
736+
737+ if ( oEvent . mParameters . type == "removed" ) {
738+ let removedTokens = [ ] ;
739+ oEvent . mParameters . removedTokens . forEach ( ( item ) => {
740+ removedTokens . push ( {
741+ KEY : item . getKey ( ) ,
742+ TEXT : item . getText ( )
743+ } ) ;
744+ }
745+ ) ;
746+ this . setProperty ( "removedTokens" , removedTokens ) ;
747+ } else {
748+ let addedTokens = [ ] ;
749+ oEvent . mParameters . addedTokens . forEach ( ( item ) => {
750+ addedTokens . push ( {
751+ KEY : item . getKey ( ) ,
752+ TEXT : item . getText ( )
753+ } ) ;
754+ }
755+ ) ;
756+ this . setProperty ( "addedTokens" , addedTokens ) ;
757+ }
758+ this . setProperty ( "rangeData" , oEvent . getSource ( ) . getRangeData ( ) ) ;
759+ this . fireChange ( ) ;
760+ } ,
761+ renderer ( oRm , oControl ) { } ,
762+ setControl ( ) {
763+ const input = z2ui5 . oView . byId ( this . getProperty ( "multiInputId" ) ) ;
764+ if ( ! input ) {
765+ return ;
766+ }
767+ if ( this . getProperty ( "checkInit" ) == true ) {
768+ return ;
769+ }
770+ this . setProperty ( "checkInit" , true ) ;
771+ input . attachTokenUpdate ( this . onTokenUpdate . bind ( this ) ) ;
772+ }
773+ } ) ;
774+ }
775+ ) ;
776+
698777sap . ui . define ( "z2ui5/CameraPicture" , [
699778 "sap/ui/core/Control" ,
700779 "sap/m/Dialog" ,
0 commit comments