@@ -147,6 +147,14 @@ class ClassHelper extends HTMLElement {
147147 }
148148
149149 const handleClickEvent = ( event ) => {
150+ if ( this . popupRef != null ) {
151+ // this.popupRef.focus();
152+ // const form = this.popupRef.document.getElementById("popup-search");
153+ // const formData = new FormData(form);
154+ // const accumulatedValues = this.popupRef.document.getElementById("popup-preview").value;
155+ this . popupRef . close ( ) ;
156+ }
157+
150158 this . openPopUp ( initialRequestURL , this . helpurlProps )
151159 . catch ( error => {
152160 // Top level error handling for openPopUp method.
@@ -793,6 +801,10 @@ class ClassHelper extends HTMLElement {
793801 const accumulatorFrag = this . getAccumulatorFragment ( preSelectedValues ) ;
794802 popupBody . appendChild ( accumulatorFrag ) ;
795803
804+ this . popupRef . addEventListener ( "beforeunload" , ( ) => {
805+ this . popupRef = null ;
806+ } ) ;
807+
796808 this . popupRef . document . addEventListener ( "keydown" , ( e ) => {
797809 if ( e . target . tagName == "TR" ) {
798810 if ( e . key === "ArrowDown" ) {
@@ -885,10 +897,10 @@ class ClassHelper extends HTMLElement {
885897
886898 const popupDocument = this . popupRef . document ;
887899 const popupBody = this . popupRef . document . body ;
888- props . pageIndex = selfPageURL . searchParams . get ( "@page_index" ) ;
900+ const pageIndex = selfPageURL . searchParams . get ( "@page_index" ) ;
889901
890902 const oldPaginationFrag = popupDocument . getElementById ( "popup-pagination" ) ;
891- const newPaginationFrag = this . getPaginationFragment ( prevPageURL , nextPageURL , props . pageIndex , props . pageSize ) ;
903+ const newPaginationFrag = this . getPaginationFragment ( prevPageURL , nextPageURL , pageIndex , props . pageSize ) ;
892904 popupBody . replaceChild ( newPaginationFrag , oldPaginationFrag ) ;
893905
894906 let oldTableFrag = popupDocument . getElementById ( "popup-tablediv" ) ;
@@ -947,12 +959,12 @@ class ClassHelper extends HTMLElement {
947959
948960 const popupDocument = this . popupRef . document ;
949961 const popupBody = this . popupRef . document . body ;
950- props . pageIndex = selfPageURL . searchParams . get ( "@page_index" ) ;
962+ const pageIndex = selfPageURL . searchParams . get ( "@page_index" ) ;
951963
952964 const oldPaginationFrag = popupDocument . getElementById ( "popup-pagination" ) ;
953965 let newPaginationFrag ;
954966 if ( prevPageURL || nextPageURL ) {
955- newPaginationFrag = this . getPaginationFragment ( prevPageURL , nextPageURL , props . pageIndex , props . pageSize ) ;
967+ newPaginationFrag = this . getPaginationFragment ( prevPageURL , nextPageURL , pageIndex , props . pageSize ) ;
956968 } else {
957969 newPaginationFrag = popupDocument . createElement ( "div" ) ;
958970 newPaginationFrag . id = "popup-pagination" ;
0 commit comments