@@ -527,7 +527,7 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
527527 useEffect ( ( ) => {
528528 if ( ! htmlDeps ) return ;
529529 // Register the Shiny HtmlDependencies
530- Shiny . renderDependenciesAsync ( [ ...htmlDeps ] ) ;
530+ window . Shiny . renderDependenciesAsync ( [ ...htmlDeps ] ) ;
531531 } , [ htmlDeps ] ) ;
532532
533533 useEffect ( ( ) => {
@@ -701,7 +701,7 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
701701 } else {
702702 console . error ( "Unhandled row selection mode:" , selectionModes ) ;
703703 }
704- Shiny . setInputValue ! ( `${ id } _cell_selection` , shinyValue ) ;
704+ window . Shiny . setInputValue ! ( `${ id } _cell_selection` , shinyValue ) ;
705705 } , [ id , selection , selectionModes , table , table . getSortedRowModel ] ) ;
706706
707707 useEffect ( ( ) => {
@@ -714,10 +714,10 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
714714 desc : sortObj . desc ,
715715 } ) ;
716716 } ) ;
717- Shiny . setInputValue ! ( `${ id } _sort` , shinySort ) ;
717+ window . Shiny . setInputValue ! ( `${ id } _sort` , shinySort ) ;
718718
719719 // Deprecated as of 2024-05-21
720- Shiny . setInputValue ! ( `${ id } _column_sort` , shinySort ) ;
720+ window . Shiny . setInputValue ! ( `${ id } _column_sort` , shinySort ) ;
721721 } , [ columns , id , sorting ] ) ;
722722 useEffect ( ( ) => {
723723 if ( ! id ) return ;
@@ -732,10 +732,10 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
732732 value : filterObj . value as FilterValue ,
733733 } ) ;
734734 } ) ;
735- Shiny . setInputValue ! ( `${ id } _filter` , shinyFilter ) ;
735+ window . Shiny . setInputValue ! ( `${ id } _filter` , shinyFilter ) ;
736736
737737 // Deprecated as of 2024-05-21
738- Shiny . setInputValue ! ( `${ id } _column_filter` , shinyFilter ) ;
738+ window . Shiny . setInputValue ! ( `${ id } _column_filter` , shinyFilter ) ;
739739 } , [ id , columnFilters , columns ] ) ;
740740 useEffect ( ( ) => {
741741 if ( ! id ) return ;
@@ -744,10 +744,10 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
744744 // Already prefiltered rows!
745745 . getSortedRowModel ( )
746746 . rows . map ( ( row ) => row . index ) ;
747- Shiny . setInputValue ! ( `${ id } _data_view_rows` , shinyRows ) ;
747+ window . Shiny . setInputValue ! ( `${ id } _data_view_rows` , shinyRows ) ;
748748
749749 // Legacy value as of 2024-05-13
750- Shiny . setInputValue ! ( `${ id } _data_view_indices` , shinyRows ) ;
750+ window . Shiny . setInputValue ! ( `${ id } _data_view_indices` , shinyRows ) ;
751751 } , [
752752 id ,
753753 table ,
@@ -773,7 +773,7 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
773773 . filter ( ( x ) : x is number => x !== null )
774774 . sort ( ) ;
775775 }
776- Shiny . setInputValue ! ( `${ id } _selected_rows` , shinyValue ) ;
776+ window . Shiny . setInputValue ! ( `${ id } _selected_rows` , shinyValue ) ;
777777 } , [ id , selection , selectionModes , table ] ) ;
778778
779779 // ### End row selection ############################################################
@@ -1083,7 +1083,7 @@ function useVirtualizerMeasureWorkaround(
10831083 return measureElementWithRetry ;
10841084}
10851085
1086- class ShinyDataFrameOutputBinding extends Shiny . OutputBinding {
1086+ class ShinyDataFrameOutputBinding extends window . Shiny . OutputBinding {
10871087 find ( scope : HTMLElement | JQuery < HTMLElement > ) : JQuery < HTMLElement > {
10881088 return $ ( scope ) . find ( "shiny-data-frame" ) ;
10891089 }
@@ -1103,7 +1103,7 @@ class ShinyDataFrameOutputBinding extends Shiny.OutputBinding {
11031103 el . clearError ( ) ;
11041104 }
11051105}
1106- Shiny . outputBindings . register (
1106+ window . Shiny . outputBindings . register (
11071107 new ShinyDataFrameOutputBinding ( ) ,
11081108 "shinyDataFrame"
11091109) ;
@@ -1215,11 +1215,14 @@ customElements.define("shiny-data-frame", ShinyDataFrameOutput);
12151215// It would be better to have something similar to session.send_input_message
12161216// for updating outputs, but that requires changes to ShinyJS.
12171217$ ( function ( ) {
1218- Shiny . addCustomMessageHandler ( "shinyDataFrameMessage" , function ( message ) {
1219- const evt = new CustomEvent ( message . handler , {
1220- detail : message . obj ,
1221- } ) ;
1222- const el = document . getElementById ( message . id ) ;
1223- el ?. dispatchEvent ( evt ) ;
1224- } ) ;
1218+ window . Shiny . addCustomMessageHandler (
1219+ "shinyDataFrameMessage" ,
1220+ function ( message ) {
1221+ const evt = new CustomEvent ( message . handler , {
1222+ detail : message . obj ,
1223+ } ) ;
1224+ const el = document . getElementById ( message . id ) ;
1225+ el ?. dispatchEvent ( evt ) ;
1226+ }
1227+ ) ;
12251228} ) ;
0 commit comments