11
2- /* Smart UI v9.1.1 (2021-Feb )
2+ /* Smart UI v9.3.53 (2021-05-10 )
33Copyright (c) 2011-2021 jQWidgets.
44License: https://htmlelements.com/license/ */ //
55
66( function ( ) {
77
88
9- const Version = '9.1.0 ' ;
9+ const Version = '9.1.27 ' ;
1010 const templates = [ ] ;
1111
1212 let namespace = 'Smart' ;
@@ -535,16 +535,16 @@ License: https://htmlelements.com/license/ */ //
535535 const isMobile = / ( i p h o n e | i p o d | i p a d | a n d r o i d | i e m o b i l e | b l a c k b e r r y | b a d a ) / . test ( window . navigator . userAgent . toLowerCase ( ) ) ;
536536 const iOS = ( ) => {
537537 return [
538- 'iPad Simulator' ,
539- 'iPhone Simulator' ,
540- 'iPod Simulator' ,
541- 'iPad' ,
542- 'iPhone' ,
543- 'iPod'
538+ 'iPad Simulator' ,
539+ 'iPhone Simulator' ,
540+ 'iPod Simulator' ,
541+ 'iPad' ,
542+ 'iPhone' ,
543+ 'iPod'
544544 ] . includes ( navigator . platform )
545- // iPad on iOS 13 detection
546- || ( navigator . userAgent . includes ( 'Mac' ) && 'ontouchend' in document )
547- }
545+ // iPad on iOS 13 detection
546+ || ( navigator . userAgent . includes ( 'Mac' ) && 'ontouchend' in document )
547+ }
548548
549549 if ( ! isMobile ) {
550550 return iOS ( ) ;
@@ -642,6 +642,13 @@ License: https://htmlelements.com/license/ */ //
642642 return String ( value ) . replace ( / [ & < > " ' ` = \/ ] / g, s => entityMap [ s ] ) ;
643643 }
644644
645+ static sanitizeHTML ( value ) {
646+ const regExp = new RegExp ( '<\s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)[^>]*>(.*?)<\s*/\s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)>' , 'ig' ) ;
647+ const result = String ( value ) . replace ( regExp , s => this . escapeHTML ( s ) ) ;
648+
649+ return result ;
650+ }
651+
645652 static createGUID ( ) {
646653 function part ( ) {
647654 return Math . floor ( ( 1 + Math . random ( ) ) * 0x10000 )
@@ -773,21 +780,65 @@ License: https://htmlelements.com/license/ */ //
773780 let styleObservedElements = [ ] ;
774781 class StyleObserver {
775782 static watch ( element ) {
776- styleObservedElements . push ( element ) ;
783+ switch ( element . nodeName . toLowerCase ( ) ) {
784+ case 'smart-grid' :
785+ case 'smart-kanban' :
786+ case 'smart-table' :
787+ case 'smart-pivot-table' :
788+ case 'smart-scheduler' :
789+ case 'smart-tabs' :
790+ case 'smart-card-view' :
791+ case 'smart-list-box' :
792+ case 'smart-combo-box' :
793+ case 'smart-drop-down-list' :
794+ case 'smart-calendar' :
795+ case 'smart-gauge' :
796+ case 'smart-numeric-text-box' :
797+ case 'smart-menu' :
798+ case 'smart-tree' :
799+ styleObservedElements . push ( element ) ;
800+ break ;
801+ default : {
802+ return ;
803+ }
804+ }
805+
806+ StyleObserver . start ( ) ;
807+ }
808+
809+ static start ( ) {
810+ if ( StyleObserver . isStarted ) {
811+ return ;
812+ }
813+
814+ StyleObserver . isStarted = true ;
777815
778816 if ( StyleObserver . interval ) {
779817 clearInterval ( StyleObserver . interval ) ;
780818 }
781819
820+ if ( styleObservedElements . length === 0 || document . hidden ) {
821+ StyleObserver . isStarted = false ;
822+ return ;
823+ }
824+
782825 StyleObserver . interval = setInterval ( function ( ) {
783826 StyleObserver . observe ( ) ;
784827 } , 100 ) ;
785828 }
786829
830+ static stop ( ) {
831+ StyleObserver . isStarted = false ;
832+
833+ if ( StyleObserver . interval ) {
834+ clearInterval ( StyleObserver . interval ) ;
835+ }
836+ }
837+
787838 static observeElement ( element ) {
788839 const that = element ;
789840
790- if ( window . Smart . Mode === 'test' ) {
841+ if ( window . Smart . Mode === 'test' || document . hidden ) {
791842 if ( StyleObserver . interval ) {
792843 clearInterval ( StyleObserver . interval ) ;
793844 }
@@ -886,21 +937,15 @@ License: https://htmlelements.com/license/ */ //
886937 }
887938
888939 static unwatch ( element ) {
889- if ( StyleObserver . interval ) {
890- clearInterval ( StyleObserver . interval ) ;
891- }
940+ StyleObserver . stop ( ) ;
892941
893942 const elementIndex = styleObservedElements . indexOf ( element ) ;
894943
895944 if ( elementIndex !== - 1 ) {
896945 styleObservedElements . splice ( elementIndex , 1 ) ;
897946 }
898947
899- if ( styleObservedElements . length > 0 ) {
900- StyleObserver . interval = setInterval ( function ( ) {
901- StyleObserver . observe ( ) ;
902- } , 100 ) ;
903- }
948+ StyleObserver . start ( ) ;
904949 }
905950 }
906951
@@ -971,6 +1016,11 @@ License: https://htmlelements.com/license/ */ //
9711016 if ( Smart . Utilities . Core . Browser . Firefox ) {
9721017 if ( ! that . target . resizeObserver ) {
9731018 let firstCallPassed = false ;
1019+ let dirty , newWidth , newHeight ;
1020+
1021+ let lastWidth = that . target . offsetWidth ;
1022+ let lastHeight = that . target . offsetHeight ;
1023+
9741024 const resizeObserver = new ResizeObserver ( ( ) => {
9751025 if ( ! firstCallPassed ) {
9761026 firstCallPassed = true ;
@@ -982,7 +1032,19 @@ License: https://htmlelements.com/license/ */ //
9821032 cancelable : true
9831033 } ) ;
9841034
1035+ newWidth = that . target . offsetWidth ;
1036+ newHeight = that . target . offsetHeight ;
1037+ dirty = newWidth !== lastWidth || newHeight !== lastHeight ;
1038+ if ( that . target . requiresLayout ) {
1039+ dirty = true ;
1040+ }
1041+
1042+ if ( ! dirty ) {
1043+ return ;
1044+ }
1045+
9851046 that . resize ( resizeEvent ) ;
1047+ that . target . requiresLayout = false ;
9861048 } ) ;
9871049
9881050 resizeObserver . observe ( that . target ) ;
@@ -2149,6 +2211,7 @@ License: https://htmlelements.com/license/ */ //
21492211 try {
21502212 let opts = Object . defineProperty ( {
21512213 } , 'passive' , {
2214+ // eslint-disable-next-line getter-return
21522215 get : function ( ) {
21532216 that . supportsPassive = true ;
21542217 }
@@ -2589,6 +2652,25 @@ License: https://htmlelements.com/license/ */ //
25892652 }
25902653
25912654 const $document = Utilities . Extend ( document ) ;
2655+ let observerTimer = null ;
2656+
2657+ document . addEventListener ( 'click' , ( ) => {
2658+ StyleObserver . start ( ) ;
2659+ if ( observerTimer ) {
2660+ clearTimeout ( observerTimer ) ;
2661+ }
2662+ observerTimer = setTimeout ( ( ) => {
2663+ StyleObserver . stop ( ) ;
2664+ } , 10000 ) ;
2665+ } ) ;
2666+
2667+ document . addEventListener ( 'mouseenter' , ( ) => {
2668+ StyleObserver . start ( ) ;
2669+ } ) ;
2670+
2671+ document . addEventListener ( 'mouseleave' , ( ) => {
2672+ StyleObserver . stop ( ) ;
2673+ } ) ;
25922674
25932675 class BindingModule {
25942676
@@ -5395,6 +5477,7 @@ License: https://htmlelements.com/license/ */ //
53955477 if ( context ) {
53965478 const elementProperty = context . _properties [ subPropertyName ] ;
53975479
5480+ // eslint-disable-next-line no-prototype-builtins
53985481 if ( parentProperty . value . hasOwnProperty ( propertyName ) ) {
53995482 if ( ! elementProperty . isDefined ) {
54005483 delete parentProperty . value [ propertyName ] ;
@@ -5514,6 +5597,7 @@ License: https://htmlelements.com/license/ */ //
55145597 delete that [ propertyName ] ;
55155598 }
55165599
5600+ // eslint-disable-next-line no-prototype-builtins
55175601 if ( window . navigator . userAgent . indexOf ( 'PhantomJS' ) === - 1 && that . hasOwnProperty ( propertyName ) ) {
55185602 defaultValue = that [ propertyName ] ;
55195603
@@ -5555,6 +5639,7 @@ License: https://htmlelements.com/license/ */ //
55555639
55565640 that . propertyByAttributeName [ property . attributeName ] = that . _properties [ propertyName ] ;
55575641
5642+ // eslint-disable-next-line no-prototype-builtins
55585643 if ( ! property . hasOwnProperty ( 'type' ) ) {
55595644 const localizedError = that . localize ( 'propertyUnknownType' , {
55605645 name : propertyName
@@ -5873,6 +5958,7 @@ License: https://htmlelements.com/license/ */ //
58735958 }
58745959 }
58755960
5961+ // eslint-disable-next-line no-prototype-builtins
58765962 if ( ! property . hasOwnProperty ( 'type' ) ) {
58775963 const localizedError = that . localize ( 'propertyUnknownType' , {
58785964 name : propertyName
@@ -6033,6 +6119,7 @@ License: https://htmlelements.com/license/ */ //
60336119 Utilities . Core . assign ( property . value , defaultProperties [ propertyName ] . value ) ;
60346120 }
60356121
6122+ // eslint-disable-next-line no-prototype-builtins
60366123 if ( proto . hasOwnProperty ( propertyName ) ) {
60376124 continue ;
60386125 }
@@ -6112,6 +6199,10 @@ License: https://htmlelements.com/license/ */ //
61126199 const that = this ;
61136200 const rootNode = that . getRootNode ( ) ;
61146201
6202+ if ( that . hasAttribute ( 'smart-blazor' ) ) {
6203+ return false ;
6204+ }
6205+
61156206 return rootNode !== document && rootNode !== that ;
61166207 }
61176208
@@ -6532,7 +6623,7 @@ License: https://htmlelements.com/license/ */ //
65326623 break ;
65336624 }
65346625
6535- if ( that . parents [ i ] . hasAttribute ( 'ng-version' ) ) {
6626+ if ( that . parents [ i ] . hasAttribute ( 'ng-version' ) && ! that . classList . contains ( 'smart-angular' ) ) {
65366627 window [ namespace ] . RenderMode = 'manual' ;
65376628 break ;
65386629 }
@@ -7741,6 +7832,7 @@ License: https://htmlelements.com/license/ */ //
77417832 BaseUrl : './' ,
77427833 StyleBaseUrl : '/styles/default/' ,
77437834 Version : Version ,
7835+ Templates : templates ,
77447836 RenderMode : userDefinedSettings . RenderMode || 'auto' ,
77457837 Render : render ,
77467838 Data : data ,
@@ -7911,8 +8003,6 @@ License: https://htmlelements.com/license/ */ //
79118003
79128004 static get listeners ( ) {
79138005 return {
7914- 'horizontalScrollBar.change' : '_horizontalScrollbarHandler' ,
7915- 'verticalScrollBar.change' : '_verticalScrollbarHandler' ,
79168006 'touchmove' : '_touchmoveHandler' ,
79178007 'touchstart' : '_touchstartHandler' ,
79188008 'wheel' : '_mouseWheelHandler' ,
@@ -7985,7 +8075,9 @@ License: https://htmlelements.com/license/ */ //
79858075
79868076 that . $ . scrollViewerContentContainer . style . left = ( ( that . rightToLeft ? 1 : - 1 ) * that . scrollLeft ) + 'px' ;
79878077
7988- event . stopPropagation ( ) ;
8078+ if ( event . stopPropagation ) {
8079+ event . stopPropagation ( ) ;
8080+ }
79898081
79908082 if ( that . onHorizontalChange ) {
79918083 that . onHorizontalChange ( event ) ;
@@ -7997,7 +8089,9 @@ License: https://htmlelements.com/license/ */ //
79978089
79988090 that . $ . scrollViewerContentContainer . style . top = - that . scrollTop + 'px' ;
79998091
8000- event . stopPropagation ( ) ;
8092+ if ( event . stopPropagation ) {
8093+ event . stopPropagation ( ) ;
8094+ }
80018095
80028096 if ( that . onVerticalChange ) {
80038097 that . onVerticalChange ( event ) ;
@@ -8266,6 +8360,16 @@ License: https://htmlelements.com/license/ */ //
82668360
82678361 const that = this ;
82688362
8363+ that . $ . verticalScrollBar . onChange = ( event ) => {
8364+ event . detail = event ;
8365+ that . _verticalScrollbarHandler ( event ) ;
8366+ }
8367+
8368+ that . $ . horizontalScrollBar . onChange = ( event ) => {
8369+ event . detail = event ;
8370+ that . _horizontalScrollbarHandler ( event ) ;
8371+ }
8372+
82698373 that . $ . verticalScrollBar . setAttribute ( 'aria-controls' , that . id ) ;
82708374 that . $ . horizontalScrollBar . setAttribute ( 'aria-controls' , that . id ) ;
82718375
@@ -8542,7 +8646,7 @@ License: https://htmlelements.com/license/ */ //
85428646 const positionDetection = this ,
85438647 that = positionDetection . context ;
85448648
8545- if ( that . dropDownPosition !== 'auto' || that . disabled ) {
8649+ if ( that . dropDownPosition !== 'auto' || that . disabled || that . isHidden ) {
85468650 return ;
85478651 }
85488652
@@ -8553,6 +8657,10 @@ License: https://htmlelements.com/license/ */ //
85538657 let start = Date . now ( ) , animationFrame ;
85548658
85558659 function loop ( ) {
8660+ if ( that . isHidden || document . hidden ) {
8661+ return ;
8662+ }
8663+
85568664 animationFrame = requestAnimFrame ( loop ) ;
85578665
85588666 //Cancel condition.
@@ -8561,6 +8669,10 @@ License: https://htmlelements.com/license/ */ //
85618669 cancelAnimationFrame ( animationFrame ) ;
85628670 }
85638671
8672+ if ( that . isHidden ) {
8673+ cancelAnimationFrame ( animationFrame ) ;
8674+ }
8675+
85648676 const current = Date . now ( ) ;
85658677
85668678 if ( current - start >= 200 ) {
@@ -8953,7 +9065,7 @@ License: https://htmlelements.com/license/ */ //
89539065 const positionedParent = this . context . _positionedParent ;
89549066 let xOffset , yOffset ;
89559067
8956- if ( positionedParent ) {
9068+ if ( positionedParent && positionedParent . nodeName !== '#document-fragment' ) {
89579069 const parentRect = positionedParent . getBoundingClientRect ( ) ;
89589070
89599071 xOffset = - parentRect . left ;
0 commit comments