diff --git a/src/controls/MMapRouteControl/MMapWaypointInput/index.css b/src/controls/MMapRouteControl/MMapWaypointInput/index.css index b642836..37e1927 100644 --- a/src/controls/MMapRouteControl/MMapWaypointInput/index.css +++ b/src/controls/MMapRouteControl/MMapWaypointInput/index.css @@ -36,7 +36,8 @@ .mappable--route-control_waypoint-input__field { box-sizing: border-box; height: 40px; - padding: 12px; + padding: 12px 30px 12px 12px; + text-overflow: ellipsis; border: none; border-radius: 8px; background: rgba(92, 94, 102, 0.06); diff --git a/src/controls/MMapRouteControl/MMapWaypointInput/index.ts b/src/controls/MMapRouteControl/MMapWaypointInput/index.ts index 1da60a2..bde3bf5 100644 --- a/src/controls/MMapRouteControl/MMapWaypointInput/index.ts +++ b/src/controls/MMapRouteControl/MMapWaypointInput/index.ts @@ -32,6 +32,7 @@ export type SelectWaypointArgs = { export type MMapWaypointInputProps = { type: 'from' | 'to'; inputPlaceholder: string; + value?: string; waypoint?: LngLat | null; geolocationTextInput?: string; search?: ({params, map}: CustomSearch) => Promise | SearchResponse; @@ -68,6 +69,10 @@ export class MMapWaypointInput extends mappable.MMapComplexEntity { this._inputEl.value = text; }, - onSuggestClick: (params: SearchParams) => { - this._inputEl.value = params.text; + onSuggestClick: () => { this._submitWaypointInput(); } }); @@ -167,7 +171,7 @@ export class MMapWaypointInput extends mappable.MMapComplexEntity { this._isInputFocused = true; + this._suggestComponent.update({suggestNavigationAction: undefined}); this._addDirectChild(this._suggestComponent); this._updateIndicatorStatus('focus'); }; @@ -239,6 +244,7 @@ export class MMapWaypointInput extends mappable.MMapComplexEntity { const [fromOld, toOld] = this._waypoints; - this._waypointInputToElement.update({waypoint: fromOld === null ? null : fromOld.geometry.coordinates}); - this._waypointInputFromElement.update({waypoint: toOld === null ? null : toOld.geometry.coordinates}); + const fromValue = this._waypointInputFromElement.getValue(); + const toValue = this._waypointInputToElement.getValue(); + this._waypointInputToElement.update({ + waypoint: fromOld === null ? null : fromOld.geometry.coordinates, + value: !fromValue ? null : fromValue + }); + this._waypointInputFromElement.update({ + waypoint: toOld === null ? null : toOld.geometry.coordinates, + value: !toValue ? null : toValue + }); }; private _onUpdateWaypoints(feature: Feature | null, index: number) { diff --git a/src/controls/MMapSearchControl/MMapSuggest/index.ts b/src/controls/MMapSearchControl/MMapSuggest/index.ts index 61b10a7..a53bd26 100644 --- a/src/controls/MMapSearchControl/MMapSuggest/index.ts +++ b/src/controls/MMapSearchControl/MMapSuggest/index.ts @@ -54,6 +54,7 @@ class MMapSuggest extends mappable.MMapComplexEntity { this._addSuggestItems(suggestResult, this._props.onSuggestClick); + this._getSuggestElements().at(0)?.classList.add(ACTIVE_CLASS); this._rootElement?.classList.toggle(HIDE_CLASS, !this.children.length); };