@@ -40,6 +40,21 @@ parser.addArgument("target", "body");
4040parser . addArgument ( "arrow-padding" , null ) ;
4141parser . addArgument ( "url" , null ) ;
4242
43+ // Tippy Lifecycle-hooks
44+ // See: https://tippyjs.bootcss.com/lifecycle-hooks/
45+ // onCreate
46+ // onTrigger
47+ // onShow
48+ // onMount
49+ // onShown
50+ // onUntrigger
51+ // onHide
52+ // onHidden
53+ //
54+ // onBeforeUpdate
55+ // onAfterUpdate
56+ // onDestroy
57+
4358export default Base . extend ( {
4459 name : "tooltip" ,
4560 trigger : ".pat-tooltip, .pat-tooltip-ng" ,
@@ -246,6 +261,26 @@ export default Base.extend({
246261 registry . scan ( this . tippy . popper ) ;
247262 } ,
248263
264+ async _onShow ( ) {
265+ if ( this . options . closing !== "auto" && this . options . trigger === "hover" ) {
266+ // no auto-close when hovering when closing mode is "sticky" or "close-button".
267+ this . tippy . setProps ( { trigger : "click" } ) ;
268+ }
269+
270+ if ( this . options . markInactive ) {
271+ this . el . classList . remove ( this . inactive_class ) ;
272+ this . el . classList . add ( this . active_class ) ;
273+ }
274+
275+ if ( this . options . source === "ajax" ) {
276+ await this . _get_content ( ) ;
277+ // Also initialize content.
278+ // Due to asynchronous ``_onShow`` the content might not be
279+ // available before ``_onMount``.
280+ this . _initialize_content ( ) ;
281+ }
282+ } ,
283+
249284 _onMount ( ) {
250285 // Notify parent patterns about injected content.
251286 // Do not call pat-inject's handler, because all necessary
@@ -288,26 +323,6 @@ export default Base.extend({
288323 this . _initialize_content ( ) ;
289324 } ,
290325
291- async _onShow ( ) {
292- if ( this . options . closing !== "auto" && this . options . trigger === "hover" ) {
293- // no auto-close when hovering when closing mode is "sticky" or "close-button".
294- this . tippy . setProps ( { trigger : "click" } ) ;
295- }
296-
297- if ( this . options . markInactive ) {
298- this . el . classList . remove ( this . inactive_class ) ;
299- this . el . classList . add ( this . active_class ) ;
300- }
301-
302- if ( this . options . source === "ajax" ) {
303- await this . _get_content ( ) ;
304- // Also initialize content.
305- // Due to asynchronous ``_onShow`` the content might not be
306- // available when ``_onMount``, which does also a ``_initialize_content``.
307- this . _initialize_content ( ) ;
308- }
309- } ,
310-
311326 _onHide ( ) {
312327 if ( this . options . markInactive ) {
313328 this . el . classList . remove ( this . active_class ) ;
0 commit comments