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

Class Picker

core/src/components/picker/picker.tsx:18–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16 shadow: true,
17})
18export class Picker implements ComponentInterface {
19 private inputEl?: HTMLInputElement;
20 private useInputMode = false;
21 private inputModeColumn?: HTMLIonPickerColumnElement;
22 private highlightEl?: HTMLElement;
23 private actionOnClick?: () => void;
24 private destroyKeypressListener?: () => void;
25 private singleColumnSearchTimeout?: ReturnType<typeof setTimeout>;
26
27 @Element() el!: HTMLIonPickerElement;
28
29 /**
30 * @internal
31 */
32 @Event() ionInputModeChange!: EventEmitter<PickerChangeEventDetail>;
33
34 /**
35 * When the picker is interacted with
36 * we need to prevent touchstart so other
37 * gestures do not fire. For example,
38 * scrolling on the wheel picker
39 * in ion-datetime should not cause
40 * a card modal to swipe to close.
41 */
42 @Listen('touchstart')
43 preventTouchStartPropagation(ev: TouchEvent) {
44 ev.stopPropagation();
45 }
46
47 componentWillLoad() {
48 getElementRoot(this.el).addEventListener('focusin', this.onFocusIn);
49 getElementRoot(this.el).addEventListener('focusout', this.onFocusOut);
50 }
51
52 private isInHighlightBounds = (ev: PointerEvent) => {
53 const { highlightEl } = this;
54 if (!highlightEl) {
55 return false;
56 }
57
58 const bbox = highlightEl.getBoundingClientRect();
59 /**
60 * Check to see if the user clicked
61 * outside the bounds of the highlight.
62 */
63 const outsideX = ev.clientX < bbox.left || ev.clientX > bbox.right;
64 const outsideY = ev.clientY < bbox.top || ev.clientY > bbox.bottom;
65 if (outsideX || outsideY) {
66 return false;
67 }
68
69 return true;
70 };
71
72 /**
73 * If we are no longer focused
74 * on a picker column, then we should
75 * exit input mode. An exception is made

Callers

nothing calls this directly

Calls 6

exitInputModeMethod · 0.95
fromMethod · 0.80
replaceMethod · 0.80
addEventListenerMethod · 0.65
removeEventListenerMethod · 0.65
setValueMethod · 0.45

Tested by

no test coverage detected