MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / openPopover

Method openPopover

core/src/components/select/select.tsx:645–713  ·  view source on GitHub ↗
(ev: UIEvent)

Source from the content-addressed store, hash-verified

643 }
644
645 private async openPopover(ev: UIEvent) {
646 const { fill, labelPlacement } = this;
647 const interfaceOptions = this.interfaceOptions;
648 const mode = getIonMode(this);
649 const showBackdrop = mode === 'md' ? false : true;
650 const multiple = this.multiple;
651 const value = this.value;
652
653 let event: Event | CustomEvent = ev;
654 let size = 'auto';
655
656 const hasFloatingOrStackedLabel = labelPlacement === 'floating' || labelPlacement === 'stacked';
657 /**
658 * The popover should take up the full width
659 * when using a fill in MD mode or if the
660 * label is floating/stacked.
661 */
662 if (hasFloatingOrStackedLabel || (mode === 'md' && fill !== undefined)) {
663 size = 'cover';
664
665 /**
666 * Otherwise the popover
667 * should be positioned relative
668 * to the native element.
669 */
670 } else {
671 event = {
672 ...ev,
673 detail: {
674 ionShadowTarget: this.nativeWrapperEl,
675 },
676 };
677 }
678
679 const popoverOpts: PopoverOptions = {
680 mode,
681 event,
682 alignment: 'center',
683 size,
684 showBackdrop,
685 ...interfaceOptions,
686
687 component: 'ion-select-popover',
688 cssClass: ['select-popover', interfaceOptions.cssClass],
689 componentProps: {
690 header: interfaceOptions.header,
691 subHeader: interfaceOptions.subHeader,
692 message: interfaceOptions.message,
693 multiple,
694 value,
695 options: this.createOverlaySelectOptions(this.childOpts, value),
696 },
697 };
698
699 /**
700 * Workaround for Stencil to autodefine
701 * ion-select-popover and ion-popover when
702 * using Custom Elements build.

Callers 1

createOverlayMethod · 0.95

Calls 3

getIonModeFunction · 0.90
createMethod · 0.65

Tested by

no test coverage detected