@@ -4,7 +4,6 @@ import type {
4
4
OnBeforeRowDetailToggleArgs ,
5
5
OnRowBackToViewportRangeArgs ,
6
6
RxJsFacade ,
7
- SlickEventHandler ,
8
7
SlickGrid ,
9
8
} from '@slickgrid-universal/common' ;
10
9
import {
@@ -58,13 +57,6 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
58
57
return this . gridOptions . datasetIdPropertyName || 'id' ;
59
58
}
60
59
61
- get eventHandler ( ) : SlickEventHandler {
62
- return this . _eventHandler ;
63
- }
64
- set eventHandler ( eventHandler : SlickEventHandler ) {
65
- this . _eventHandler = eventHandler ;
66
- }
67
-
68
60
/** Getter for the Grid Options pulled through the Grid Object */
69
61
get gridOptions ( ) : GridOption {
70
62
return ( this . _grid ?. getOptions ( ) || { } ) as GridOption ;
@@ -150,82 +142,68 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
150
142
this . rowDetailViewOptions . onExtensionRegistered ( this ) ;
151
143
}
152
144
153
- if ( this . onAsyncResponse ) {
154
- this . eventHandler . subscribe ( this . onAsyncResponse , ( event , args ) => {
155
- if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onAsyncResponse === 'function' ) {
156
- this . rowDetailViewOptions . onAsyncResponse ( event , args ) ;
157
- }
158
- } ) ;
159
- }
160
-
161
- if ( this . onAsyncEndUpdate ) {
162
- this . eventHandler . subscribe ( this . onAsyncEndUpdate , ( e , args ) => {
163
- // destroy preload if exists
164
- this . _preloadCompRef ?. destroy ( ) ;
165
-
166
- // triggers after backend called "onAsyncResponse.notify()"
167
- this . renderViewModel ( args ?. item ) ;
168
-
169
- if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onAsyncEndUpdate === 'function' ) {
170
- this . rowDetailViewOptions . onAsyncEndUpdate ( e , args ) ;
171
- }
172
- } ) ;
173
- }
174
-
175
- if ( this . onAfterRowDetailToggle ) {
176
- this . eventHandler . subscribe (
177
- this . onAfterRowDetailToggle ,
178
- ( e : any , args : { grid : SlickGrid ; item : any ; expandedRows : Array < number | string > } ) => {
179
- // display preload template & re-render all the other Detail Views after toggling
180
- // the preload View will eventually go away once the data gets loaded after the "onAsyncEndUpdate" event
181
- this . renderPreloadView ( ) ;
182
-
183
- if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onAfterRowDetailToggle === 'function' ) {
184
- this . rowDetailViewOptions . onAfterRowDetailToggle ( e , args ) ;
185
- }
186
- }
187
- ) ;
188
- }
189
-
190
- if ( this . onBeforeRowDetailToggle ) {
191
- this . eventHandler . subscribe ( this . onBeforeRowDetailToggle , ( e , args ) => {
192
- // before toggling row detail, we need to create View Component if it doesn't exist
193
- this . handleOnBeforeRowDetailToggle ( e , args ) ;
194
-
195
- if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onBeforeRowDetailToggle === 'function' ) {
196
- return this . rowDetailViewOptions . onBeforeRowDetailToggle ( e , args ) ;
145
+ this . eventHandler . subscribe ( this . onAsyncResponse , ( event , args ) => {
146
+ if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onAsyncResponse === 'function' ) {
147
+ this . rowDetailViewOptions . onAsyncResponse ( event , args ) ;
148
+ }
149
+ } ) ;
150
+
151
+ this . eventHandler . subscribe ( this . onAsyncEndUpdate , ( e , args ) => {
152
+ // destroy preload if exists
153
+ this . _preloadCompRef ?. destroy ( ) ;
154
+
155
+ // triggers after backend called "onAsyncResponse.notify()"
156
+ this . renderViewModel ( args ?. item ) ;
157
+
158
+ if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onAsyncEndUpdate === 'function' ) {
159
+ this . rowDetailViewOptions . onAsyncEndUpdate ( e , args ) ;
160
+ }
161
+ } ) ;
162
+
163
+ this . eventHandler . subscribe (
164
+ this . onAfterRowDetailToggle ,
165
+ ( e : any , args : { grid : SlickGrid ; item : any ; expandedRows : Array < number | string > } ) => {
166
+ // display preload template & re-render all the other Detail Views after toggling
167
+ // the preload View will eventually go away once the data gets loaded after the "onAsyncEndUpdate" event
168
+ this . renderPreloadView ( ) ;
169
+
170
+ if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onAfterRowDetailToggle === 'function' ) {
171
+ this . rowDetailViewOptions . onAfterRowDetailToggle ( e , args ) ;
197
172
}
198
- return true ;
199
- } ) ;
200
- }
201
-
202
- if ( this . onRowBackToViewportRange ) {
203
- this . eventHandler . subscribe ( this . onRowBackToViewportRange , ( e , args ) => {
204
- // when row is back to viewport range, we will re-render the View Component(s)
205
- this . handleOnRowBackToViewportRange ( e , args ) ;
206
-
207
- if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onRowBackToViewportRange === 'function' ) {
208
- this . rowDetailViewOptions . onRowBackToViewportRange ( e , args ) ;
209
- }
210
- } ) ;
211
- }
212
-
213
- if ( this . onBeforeRowOutOfViewportRange ) {
214
- this . _eventHandler . subscribe ( this . onBeforeRowOutOfViewportRange , ( event , args ) => {
215
- if ( typeof this . rowDetailViewOptions ?. onBeforeRowOutOfViewportRange === 'function' ) {
216
- this . rowDetailViewOptions . onBeforeRowOutOfViewportRange ( event , args ) ;
217
- }
218
- this . disposeViewByItem ( args . item ) ;
219
- } ) ;
220
- }
173
+ }
174
+ ) ;
221
175
222
- if ( this . onRowOutOfViewportRange ) {
223
- this . eventHandler . subscribe ( this . onRowOutOfViewportRange , ( e , args ) => {
224
- if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onRowOutOfViewportRange === 'function' ) {
225
- this . rowDetailViewOptions . onRowOutOfViewportRange ( e , args ) ;
226
- }
227
- } ) ;
228
- }
176
+ this . eventHandler . subscribe ( this . onBeforeRowDetailToggle , ( e , args ) => {
177
+ // before toggling row detail, we need to create View Component if it doesn't exist
178
+ this . handleOnBeforeRowDetailToggle ( e , args ) ;
179
+
180
+ if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onBeforeRowDetailToggle === 'function' ) {
181
+ return this . rowDetailViewOptions . onBeforeRowDetailToggle ( e , args ) ;
182
+ }
183
+ return true ;
184
+ } ) ;
185
+
186
+ this . eventHandler . subscribe ( this . onRowBackToViewportRange , ( e , args ) => {
187
+ // when row is back to viewport range, we will re-render the View Component(s)
188
+ this . handleOnRowBackToViewportRange ( e , args ) ;
189
+
190
+ if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onRowBackToViewportRange === 'function' ) {
191
+ this . rowDetailViewOptions . onRowBackToViewportRange ( e , args ) ;
192
+ }
193
+ } ) ;
194
+
195
+ this . _eventHandler . subscribe ( this . onBeforeRowOutOfViewportRange , ( event , args ) => {
196
+ if ( typeof this . rowDetailViewOptions ?. onBeforeRowOutOfViewportRange === 'function' ) {
197
+ this . rowDetailViewOptions . onBeforeRowOutOfViewportRange ( event , args ) ;
198
+ }
199
+ this . disposeViewByItem ( args . item ) ;
200
+ } ) ;
201
+
202
+ this . eventHandler . subscribe ( this . onRowOutOfViewportRange , ( e , args ) => {
203
+ if ( this . rowDetailViewOptions && typeof this . rowDetailViewOptions . onRowOutOfViewportRange === 'function' ) {
204
+ this . rowDetailViewOptions . onRowOutOfViewportRange ( e , args ) ;
205
+ }
206
+ } ) ;
229
207
230
208
// --
231
209
// hook some events needed by the Plugin itself
0 commit comments