Salesforce Full Calendar Tooltip создается, но не отображается - PullRequest
0 голосов
/ 27 апреля 2020

У меня есть компонент ауры, который отображает полный вид временной шкалы календаря, и я пытаюсь отобразить всплывающую подсказку, используя popper и tooltip. js. Как видно из изображения консоли браузера, всплывающая подсказка создается при вводе мыши, но не отображается.

Скрипты из компонента

   <ltng:require scripts="{!join(',',
                       $Resource.FullCalendarCoreMainV4_3_1JS, 
                       $Resource.FullCalendarMomentMainV4_3_1JS,
                       $Resource.FullCalendarTimelineMainV4_3_1JS,
                       $Resource.FullCalendarResourceCommonMainV4_3_1JS,
                       $Resource.FullCalendarResourceTimelineMainV4_3_1JS,
                       $Resource.PopperMin, 
                       $Resource.TooltipMin
                       )}"
             styles="{!join(',',
                      $Resource.FullCalendarCoreMainV4_3_1CSS,
                      $Resource.FullCalendarTimelineMainV4_3_1CSS,
                      $Resource.FullCalendarResourceTimelineMainV4_3_1CSS)}"  
              afterScriptsLoaded="{!c.scriptsLoaded}"
              />

Скрипты, загруженные методом из контроллера

scriptsLoaded : function(component, event, helper) {
    console.log('Calendar scripts loaded'); 
    var calendarElement = document.getElementById('calendar');
    var calendar = new FullCalendar.Calendar(calendarElement,{
        plugins:['resourceTimeline'],
        editable: false,
        displayEventTime: false,
        firstDay: 1,
        aspectRatio: 1.25,
        header: {
            left: 'customPrev,customNext customToday ',
            center: 'title',
            right: 'custom5Days custom10Days customOneMonth'
        },
        timeZone: 'UTC', 
        customButtons: {
            customPrev: {
                text: '<',
                click: $A.getCallback(function() {
                    calendar.prev();
                    helper.fetchCalendarEvents(component, calendar);
                })
            },
            customNext: {
                text: '>',
                click: $A.getCallback(function() {
                    calendar.next();
                    helper.fetchCalendarEvents(component, calendar);                    })
            },
            customToday: {
                text: 'today',
                click: $A.getCallback(function() {
                    calendar.today();
                    helper.fetchCalendarEvents(component, calendar);
                })
            },
            custom5Days: {
                text: '5 Days',
                click: $A.getCallback(function() {
                    calendar.changeView('timelineFiveDays');
                    helper.fetchCalendarEvents(component, calendar);
                })
            },
            custom10Days: {
                text: '10 Days',
                click: $A.getCallback(function() {
                    calendar.changeView('timelineTenDays');
                    helper.fetchCalendarEvents(component, calendar);
                })
            },
            customOneMonth: {
                text: 'Month',
                click: $A.getCallback(function() {
                    calendar.changeView('timelineOneMonth');
                    helper.fetchCalendarEvents(component, calendar);
                })
            }
        },
        defaultView: 'timelineFiveDays',
        views: {             
            timelineFiveDays:{
                type: 'resourceTimeline',
                duration: { weeks: 1 },
                slotDuration: {days: 1},
                weekends: false,
                buttonText: '5 Days'
            },
            timelineTenDays:{
                type: 'resourceTimeline',
                duration: { weeks: 2 },
                slotDuration: {days: 1},
                weekends: false,
                buttonText: '10 Days'
            },
            timelineOneMonth:{
                type: 'resourceTimeline',
                duration: {months:1},
                slotDuration: {days: 1},
                weekends: false,
                buttonText: 'Month'
            }
        },
        slotLabelFormat: [
            {day: 'numeric', weekday: 'short'}
        ],
        resourceLabelText:'Technicians',
        resourceAreaWidth:'20%',
        resources:[],
        events: [],
        eventMouseEnter: function(info){
            console.log('Mouse entered');
            var tooltip = new Tooltip(info.el, {
                title: info.event.title,
                placement: 'top',
                trigger: 'hover',
                container: 'body'
            });
            console.log('Tool tip = ', tooltip);
            tooltip.show();
        },
        eventReceive: $A.getCallback(function(info) {
            var calendarDateOnly = new Date(info.event.start);
            calendarDateOnly.setHours(0,0,0,0);
            var eventTag = info.draggedEl.dataset.tag;
            console.log('event dropped', info);   
            console.log('event resources', info.event.getResources());
            console.log('event tag', eventTag);

            if (eventTag == 'PSWork')
            {
                var eventDateStarts = info.draggedEl.dataset.starts;
                var eventDateOnly = new Date(eventDateStarts);
                eventDateOnly.setHours(0,0,0,0);
                if (calendarDateOnly.getTime() !== eventDateOnly.getTime()) {
                    alert('The project must be scheduled for ' + eventDateStarts);
                    info.event.remove();
                    return;
                }
            }  

            alert('You are about to schedule event ' + info.event.title + ' for the ' + info.event.start);
            helper.scheduleCalendarEvent(component, calendar, info.event, eventTag);
            if(eventTag !== 'Placeholder')
            {
               info.draggedEl.parentNode.removeChild(info.draggedEl);  
            } 
        })
    });
    calendar.render();
    component.set('v._Calendar', calendar);
    helper.fetchCalendarEvents(component, calendar);
},

CSS от Style

.THIS .popper .tooltip {
  position: absolute;
  z-index: 9999;
  background: #FFC107;
  color: black;
  width: 150px;
  border-radius: 3px;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
  padding: 10px;
  text-align: center;
}
.THIS .style5 .tooltip {
  background: #1E252B;
  color: #FFFFFF;
  max-width: 200px;
  width: auto;
  font-size: .8rem;
  padding: .5em 1em;
}
.THIS .popper .popper__arrow .tooltip .tooltip-arrow {
  width: 0;
  height: 0;
  border-style: solid;
  position: absolute;
  margin: 5px;
}

.THIS .tooltip .tooltip-arrow .popper .popper__arrow {
  border-color: #FFC107;
}
.THIS .style5 .tooltip .tooltip-arrow {
  border-color: #1E252B;
}
.THIS .popper[x-placement^="top"] .tooltip[x-placement^="top"] {
  margin-bottom: 5px;
}
.THIS .popper[x-placement^="top"] .popper__arrow .tooltip[x-placement^="top"] .tooltip-arrow {
  border-width: 5px 5px 0 5px;
  border-left-color: transparent;
  border-right-color: transparent;
  border-bottom-color: transparent;
  bottom: -5px;
  left: calc(50% - 5px);
  margin-top: 0;
  margin-bottom: 0;
}
.THIS .popper[x-placement^="bottom"] .tooltip[x-placement^="bottom"] {
  margin-top: 5px;
}
.THIS .tooltip[x-placement^="bottom"] .tooltip-arrow .popper[x-placement^="bottom"] .popper__arrow {
  border-width: 0 5px 5px 5px;
  border-left-color: transparent;
  border-right-color: transparent;
  border-top-color: transparent;
  top: -5px;
  left: calc(50% - 5px);
  margin-top: 0;
  margin-bottom: 0;
}
.THIS .tooltip[x-placement^="right"] .popper[x-placement^="right"] {
  margin-left: 5px;
}
.THIS .popper[x-placement^="right"] .popper__arrow .tooltip[x-placement^="right"] .tooltip-arrow {
  border-width: 5px 5px 5px 0;
  border-left-color: transparent;
  border-top-color: transparent;
  border-bottom-color: transparent;
  left: -5px;
  top: calc(50% - 5px);
  margin-left: 0;
  margin-right: 0;
}
.THIS .popper[x-placement^="left"] .tooltip[x-placement^="left"] {
  margin-right: 5px;
}
.THIS .popper[x-placement^="left"] .popper__arrow .tooltip[x-placement^="left"] .tooltip-arrow {
  border-width: 5px 0 5px 5px;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: transparent;
  right: -5px;
  top: calc(50% - 5px);
  margin-left: 0;
  margin-right: 0;
}

Browser Console

Любая помощь будет высоко ценится

...