MOBILE-3745 core: Add new openPopover function
parent
7af5c510bf
commit
43ed1d9917
|
@ -34,7 +34,7 @@ import { CoreCategoryData, CoreCourses, CoreEnrolledCourseData } from '@features
|
||||||
import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
|
import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
|
||||||
import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter';
|
import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { Network, NgZone, PopoverController } from '@singletons';
|
import { Network, NgZone } from '@singletons';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { Params } from '@angular/router';
|
import { Params } from '@angular/router';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
@ -535,7 +535,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
|
||||||
* @param event Event.
|
* @param event Event.
|
||||||
*/
|
*/
|
||||||
async openFilter(event: MouseEvent): Promise<void> {
|
async openFilter(event: MouseEvent): Promise<void> {
|
||||||
const popover = await PopoverController.create({
|
await CoreDomUtils.openPopover({
|
||||||
component: AddonCalendarFilterPopoverComponent,
|
component: AddonCalendarFilterPopoverComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
courses: this.courses,
|
courses: this.courses,
|
||||||
|
@ -543,7 +543,6 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
|
||||||
},
|
},
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
await popover.present();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@ import { AddonCalendar, AddonCalendarProvider } from '../../services/calendar';
|
||||||
import { AddonCalendarOffline } from '../../services/calendar-offline';
|
import { AddonCalendarOffline } from '../../services/calendar-offline';
|
||||||
import { AddonCalendarSync, AddonCalendarSyncProvider } from '../../services/calendar-sync';
|
import { AddonCalendarSync, AddonCalendarSyncProvider } from '../../services/calendar-sync';
|
||||||
import { AddonCalendarFilter, AddonCalendarHelper } from '../../services/calendar-helper';
|
import { AddonCalendarFilter, AddonCalendarHelper } from '../../services/calendar-helper';
|
||||||
import { Network, NgZone, PopoverController } from '@singletons';
|
import { Network, NgZone } from '@singletons';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { CoreEnrolledCourseData } from '@features/courses/services/courses';
|
import { CoreEnrolledCourseData } from '@features/courses/services/courses';
|
||||||
import { ActivatedRoute, Params } from '@angular/router';
|
import { ActivatedRoute, Params } from '@angular/router';
|
||||||
|
@ -333,7 +333,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
|
||||||
* @param event Event.
|
* @param event Event.
|
||||||
*/
|
*/
|
||||||
async openFilter(event: MouseEvent): Promise<void> {
|
async openFilter(event: MouseEvent): Promise<void> {
|
||||||
const popover = await PopoverController.create({
|
await CoreDomUtils.openPopover({
|
||||||
component: AddonCalendarFilterPopoverComponent,
|
component: AddonCalendarFilterPopoverComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
courses: this.courses,
|
courses: this.courses,
|
||||||
|
@ -341,7 +341,6 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
|
||||||
},
|
},
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
await popover.present();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,7 +35,7 @@ import { CoreConstants } from '@/core/constants';
|
||||||
import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter';
|
import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter';
|
||||||
import { Params } from '@angular/router';
|
import { Params } from '@angular/router';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { Network, NgZone, PopoverController } from '@singletons';
|
import { Network, NgZone } from '@singletons';
|
||||||
import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
|
import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
|
@ -616,7 +616,7 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
* @param event Event.
|
* @param event Event.
|
||||||
*/
|
*/
|
||||||
async openFilter(event: MouseEvent): Promise<void> {
|
async openFilter(event: MouseEvent): Promise<void> {
|
||||||
const popover = await PopoverController.create({
|
await CoreDomUtils.openPopover({
|
||||||
component: AddonCalendarFilterPopoverComponent,
|
component: AddonCalendarFilterPopoverComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
courses: this.courses,
|
courses: this.courses,
|
||||||
|
@ -624,7 +624,6 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
},
|
},
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
await popover.present();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {
|
||||||
AddonModForumReplyDiscussionData,
|
AddonModForumReplyDiscussionData,
|
||||||
} from '@addons/mod/forum/services/forum';
|
} from '@addons/mod/forum/services/forum';
|
||||||
import { AddonModForumOffline, AddonModForumOfflineDiscussion } from '@addons/mod/forum/services/forum-offline';
|
import { AddonModForumOffline, AddonModForumOfflineDiscussion } from '@addons/mod/forum/services/forum-offline';
|
||||||
import { PopoverController, Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
|
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
|
||||||
import { AddonModForumHelper } from '@addons/mod/forum/services/forum-helper';
|
import { AddonModForumHelper } from '@addons/mod/forum/services/forum-helper';
|
||||||
import { CoreGroups, CoreGroupsProvider } from '@services/groups';
|
import { CoreGroups, CoreGroupsProvider } from '@services/groups';
|
||||||
|
@ -667,7 +667,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
|
||||||
* @param discussion Discussion.
|
* @param discussion Discussion.
|
||||||
*/
|
*/
|
||||||
async showOptionsMenu(event: Event, discussion: AddonModForumDiscussion): Promise<void> {
|
async showOptionsMenu(event: Event, discussion: AddonModForumDiscussion): Promise<void> {
|
||||||
const popover = await PopoverController.create({
|
const popoverData = await CoreDomUtils.openPopover<{ action?: string; value: boolean }>({
|
||||||
component: AddonModForumDiscussionOptionsMenuComponent,
|
component: AddonModForumDiscussionOptionsMenuComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
discussion,
|
discussion,
|
||||||
|
@ -677,20 +677,16 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
|
|
||||||
await popover.present();
|
if (popoverData && popoverData.action) {
|
||||||
|
switch (popoverData.action) {
|
||||||
const result = await popover.onDidDismiss<{ action?: string; value: boolean }>();
|
|
||||||
|
|
||||||
if (result.data && result.data.action) {
|
|
||||||
switch (result.data.action) {
|
|
||||||
case 'lock':
|
case 'lock':
|
||||||
discussion.locked = result.data.value;
|
discussion.locked = popoverData.value;
|
||||||
break;
|
break;
|
||||||
case 'pin':
|
case 'pin':
|
||||||
discussion.pinned = result.data.value;
|
discussion.pinned = popoverData.value;
|
||||||
break;
|
break;
|
||||||
case 'star':
|
case 'star':
|
||||||
discussion.starred = result.data.value;
|
discussion.starred = popoverData.value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -40,7 +40,7 @@ import {
|
||||||
AddonModForumUpdateDiscussionPostWSOptionsObject,
|
AddonModForumUpdateDiscussionPostWSOptionsObject,
|
||||||
} from '../../services/forum';
|
} from '../../services/forum';
|
||||||
import { CoreTag } from '@features/tag/services/tag';
|
import { CoreTag } from '@features/tag/services/tag';
|
||||||
import { PopoverController, Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
||||||
import { IonContent } from '@ionic/angular';
|
import { IonContent } from '@ionic/angular';
|
||||||
import { AddonModForumSync } from '../../services/forum-sync';
|
import { AddonModForumSync } from '../../services/forum-sync';
|
||||||
|
@ -218,7 +218,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
|
||||||
* @param event Click Event.
|
* @param event Click Event.
|
||||||
*/
|
*/
|
||||||
async showOptionsMenu(event: Event): Promise<void> {
|
async showOptionsMenu(event: Event): Promise<void> {
|
||||||
const popover = await PopoverController.create({
|
const popoverData = await CoreDomUtils.openPopover<{ action?: string }>({
|
||||||
component: AddonModForumPostOptionsMenuComponent,
|
component: AddonModForumPostOptionsMenuComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
post: this.post,
|
post: this.post,
|
||||||
|
@ -228,12 +228,8 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
|
|
||||||
await popover.present();
|
if (popoverData && popoverData.action) {
|
||||||
|
switch (popoverData.action) {
|
||||||
const result = await popover.onDidDismiss<{ action?: string }>();
|
|
||||||
|
|
||||||
if (result.data && result.data.action) {
|
|
||||||
switch (result.data.action) {
|
|
||||||
case 'edit':
|
case 'edit':
|
||||||
this.editPost();
|
this.editPost();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { IonContent } from '@ionic/angular';
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreTextUtils } from '@services/utils/text';
|
import { CoreTextUtils } from '@services/utils/text';
|
||||||
import { PopoverController, Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
import {
|
import {
|
||||||
AddonModGlossary,
|
AddonModGlossary,
|
||||||
|
@ -405,7 +405,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
|
||||||
* @param event Event.
|
* @param event Event.
|
||||||
*/
|
*/
|
||||||
async openModePicker(event: MouseEvent): Promise<void> {
|
async openModePicker(event: MouseEvent): Promise<void> {
|
||||||
const popover = await PopoverController.create({
|
const mode = await CoreDomUtils.openPopover<AddonModGlossaryFetchMode>({
|
||||||
component: AddonModGlossaryModePickerPopoverComponent,
|
component: AddonModGlossaryModePickerPopoverComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
browseModes: this.glossary!.browsemodes,
|
browseModes: this.glossary!.browsemodes,
|
||||||
|
@ -414,11 +414,6 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
|
|
||||||
await popover.present();
|
|
||||||
|
|
||||||
const result = await popover.onDidDismiss<AddonModGlossaryFetchMode>();
|
|
||||||
|
|
||||||
const mode = result.data;
|
|
||||||
if (mode) {
|
if (mode) {
|
||||||
if (mode !== this.fetchMode) {
|
if (mode !== this.fetchMode) {
|
||||||
this.changeFetchMode(mode);
|
this.changeFetchMode(mode);
|
||||||
|
|
|
@ -16,10 +16,10 @@ import { BehaviorSubject } from 'rxjs';
|
||||||
|
|
||||||
import { CoreQuestionHelper } from '@features/question/services/question-helper';
|
import { CoreQuestionHelper } from '@features/question/services/question-helper';
|
||||||
import { CoreQuestionsAnswers } from '@features/question/services/question';
|
import { CoreQuestionsAnswers } from '@features/question/services/question';
|
||||||
import { PopoverController } from '@singletons';
|
|
||||||
import { CoreLogger } from '@singletons/logger';
|
import { CoreLogger } from '@singletons/logger';
|
||||||
import { AddonModQuizConnectionErrorComponent } from '../components/connection-error/connection-error';
|
import { AddonModQuizConnectionErrorComponent } from '../components/connection-error/connection-error';
|
||||||
import { AddonModQuiz, AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '../services/quiz';
|
import { AddonModQuiz, AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '../services/quiz';
|
||||||
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to support auto-save in quiz. Every certain seconds, it will check if there are changes in the current page answers
|
* Class to support auto-save in quiz. Every certain seconds, it will check if there are changes in the current page answers
|
||||||
|
@ -197,13 +197,10 @@ export class AddonModQuizAutoSave {
|
||||||
};
|
};
|
||||||
this.popoverShown = true;
|
this.popoverShown = true;
|
||||||
|
|
||||||
this.popover = await PopoverController.create({
|
this.popover = await CoreDomUtils.openPopover({
|
||||||
component: AddonModQuizConnectionErrorComponent,
|
component: AddonModQuizConnectionErrorComponent,
|
||||||
event: <Event> event,
|
event: <Event> event,
|
||||||
});
|
});
|
||||||
await this.popover.present();
|
|
||||||
|
|
||||||
await this.popover.onDidDismiss();
|
|
||||||
|
|
||||||
this.popoverShown = false;
|
this.popoverShown = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { CoreSites } from '@services/sites';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreTextUtils } from '@services/utils/text';
|
import { CoreTextUtils } from '@services/utils/text';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { PopoverController, Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
import { Md5 } from 'ts-md5';
|
import { Md5 } from 'ts-md5';
|
||||||
import { AddonModWikiPageDBRecord } from '../../services/database/wiki';
|
import { AddonModWikiPageDBRecord } from '../../services/database/wiki';
|
||||||
|
@ -794,7 +794,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
* @param event Event.
|
* @param event Event.
|
||||||
*/
|
*/
|
||||||
async showSubwikiPicker(event: MouseEvent): Promise<void> {
|
async showSubwikiPicker(event: MouseEvent): Promise<void> {
|
||||||
const popover = await PopoverController.create({
|
const popoverData = await CoreDomUtils.openPopover<AddonModWikiSubwiki>({
|
||||||
component: AddonModWikiSubwikiPickerComponent,
|
component: AddonModWikiSubwikiPickerComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
subwikis: this.subwikiData.subwikis,
|
subwikis: this.subwikiData.subwikis,
|
||||||
|
@ -803,12 +803,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
|
|
||||||
await popover.present();
|
if (popoverData) {
|
||||||
|
this.goToSubwiki(popoverData.id, popoverData.userid, popoverData.groupid, popoverData.canedit);
|
||||||
const result = await popover.onDidDismiss();
|
|
||||||
|
|
||||||
if (result.data) {
|
|
||||||
this.goToSubwiki(result.data.id, result.data.userid, result.data.groupid, result.data.canedit);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { Subject } from 'rxjs';
|
||||||
import { auditTime } from 'rxjs/operators';
|
import { auditTime } from 'rxjs/operators';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { PopoverController, Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreContextMenuItemComponent } from './context-menu-item';
|
import { CoreContextMenuItemComponent } from './context-menu-item';
|
||||||
import { CoreContextMenuPopoverComponent } from './context-menu-popover';
|
import { CoreContextMenuPopoverComponent } from './context-menu-popover';
|
||||||
|
|
||||||
|
@ -176,8 +176,9 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy {
|
||||||
*/
|
*/
|
||||||
async showContextMenu(event: MouseEvent): Promise<void> {
|
async showContextMenu(event: MouseEvent): Promise<void> {
|
||||||
if (!this.expanded) {
|
if (!this.expanded) {
|
||||||
const popover = await PopoverController.create(
|
this.expanded = true;
|
||||||
{
|
|
||||||
|
const popoverData = await CoreDomUtils.openPopover<CoreContextMenuItemComponent>({
|
||||||
event,
|
event,
|
||||||
component: CoreContextMenuPopoverComponent,
|
component: CoreContextMenuPopoverComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
@ -186,16 +187,12 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy {
|
||||||
},
|
},
|
||||||
showBackdrop: true,
|
showBackdrop: true,
|
||||||
id: this.uniqueId,
|
id: this.uniqueId,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
await popover.present();
|
|
||||||
this.expanded = true;
|
|
||||||
|
|
||||||
const data = await popover.onDidDismiss<CoreContextMenuItemComponent>();
|
|
||||||
this.expanded = false;
|
this.expanded = false;
|
||||||
|
|
||||||
if (data.data) {
|
if (popoverData) {
|
||||||
data.data.onClosed?.emit();
|
popoverData.onClosed?.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreCourses, CoreCoursesProvider } from '@features/courses/services/courses';
|
import { CoreCourses, CoreCoursesProvider } from '@features/courses/services/courses';
|
||||||
import { CoreCourse, CoreCourseProvider } from '@features/course/services/course';
|
import { CoreCourse, CoreCourseProvider } from '@features/course/services/course';
|
||||||
import { CoreCourseHelper, CorePrefetchStatusInfo } from '@features/course/services/course-helper';
|
import { CoreCourseHelper, CorePrefetchStatusInfo } from '@features/course/services/course-helper';
|
||||||
import { PopoverController, Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreConstants } from '@/core/constants';
|
import { CoreConstants } from '@/core/constants';
|
||||||
import { CoreEnrolledCourseDataWithExtraInfoAndOptions } from '../../services/courses-helper';
|
import { CoreEnrolledCourseDataWithExtraInfoAndOptions } from '../../services/courses-helper';
|
||||||
import { CoreCoursesCourseOptionsMenuComponent } from '../course-options-menu/course-options-menu';
|
import { CoreCoursesCourseOptionsMenuComponent } from '../course-options-menu/course-options-menu';
|
||||||
|
@ -198,7 +198,7 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
const popover = await PopoverController.create({
|
const popoverData = await CoreDomUtils.openPopover<string>({
|
||||||
component: CoreCoursesCourseOptionsMenuComponent,
|
component: CoreCoursesCourseOptionsMenuComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
course: this.course,
|
course: this.course,
|
||||||
|
@ -207,12 +207,8 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy {
|
||||||
},
|
},
|
||||||
event: e,
|
event: e,
|
||||||
});
|
});
|
||||||
await popover.present();
|
|
||||||
|
|
||||||
const action = await popover.onDidDismiss<string>();
|
switch (popoverData) {
|
||||||
|
|
||||||
if (action.data) {
|
|
||||||
switch (action.data) {
|
|
||||||
case 'download':
|
case 'download':
|
||||||
if (!this.prefetchCourseData.loading) {
|
if (!this.prefetchCourseData.loading) {
|
||||||
this.prefetchCourse(e);
|
this.prefetchCourse(e);
|
||||||
|
@ -238,7 +234,6 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
import { Injectable, SimpleChange, ElementRef, KeyValueChanges } from '@angular/core';
|
import { Injectable, SimpleChange, ElementRef, KeyValueChanges } from '@angular/core';
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
import { IonContent } from '@ionic/angular';
|
import { IonContent } from '@ionic/angular';
|
||||||
import { ModalOptions, AlertOptions, AlertButton, TextFieldTypes } from '@ionic/core';
|
import { ModalOptions, PopoverOptions, AlertOptions, AlertButton, TextFieldTypes } from '@ionic/core';
|
||||||
import { Md5 } from 'ts-md5';
|
import { Md5 } from 'ts-md5';
|
||||||
|
|
||||||
import { CoreApp } from '@services/app';
|
import { CoreApp } from '@services/app';
|
||||||
|
@ -796,7 +796,7 @@ export class CoreDomUtilsProvider {
|
||||||
el.addEventListener('click', async (ev: Event) => {
|
el.addEventListener('click', async (ev: Event) => {
|
||||||
const html = el.getAttribute('data-html');
|
const html = el.getAttribute('data-html');
|
||||||
|
|
||||||
const popover = await PopoverController.create({
|
await CoreDomUtils.openPopover({
|
||||||
component: CoreBSTooltipComponent,
|
component: CoreBSTooltipComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
content,
|
content,
|
||||||
|
@ -804,7 +804,6 @@ export class CoreDomUtilsProvider {
|
||||||
},
|
},
|
||||||
event: ev,
|
event: ev,
|
||||||
});
|
});
|
||||||
await popover.present();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1721,6 +1720,26 @@ export class CoreDomUtilsProvider {
|
||||||
return await this.openModal<T>(modalOptions);
|
return await this.openModal<T>(modalOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens a popover.
|
||||||
|
*
|
||||||
|
* @param popoverOptions Modal Options.
|
||||||
|
*/
|
||||||
|
async openPopover<T = void>(
|
||||||
|
popoverOptions: PopoverOptions,
|
||||||
|
): Promise<T | undefined> {
|
||||||
|
|
||||||
|
const popover = await PopoverController.create(popoverOptions);
|
||||||
|
|
||||||
|
await popover.present();
|
||||||
|
|
||||||
|
// If onDidDismiss is nedded we can add a new param to the function to wait one function or the other.
|
||||||
|
const result = await popover.onWillDismiss<T>();
|
||||||
|
if (result?.data) {
|
||||||
|
return result?.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View an image in a modal.
|
* View an image in a modal.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue