forked from MapComplete/MapComplete
		
	Huge refactoring: split readonly and writable stores
This commit is contained in:
		
							parent
							
								
									0946d8ac9c
								
							
						
					
					
						commit
						4283b76f36
					
				
					 95 changed files with 819 additions and 625 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| import Combine from "../Base/Combine"; | ||||
| import {UIEventSource} from "../../Logic/UIEventSource"; | ||||
| import {Store, UIEventSource} from "../../Logic/UIEventSource"; | ||||
| import {BBox} from "../../Logic/BBox"; | ||||
| import UserRelatedState from "../../Logic/State/UserRelatedState"; | ||||
| import Translations from "../i18n/Translations"; | ||||
|  | @ -27,7 +27,7 @@ import {AllTagsPanel} from "../AllTagsPanel"; | |||
| 
 | ||||
| class PreviewPanel extends ScrollableFullScreen { | ||||
| 
 | ||||
|     constructor(tags: UIEventSource<any>, layer) { | ||||
|     constructor(tags: UIEventSource<any>) { | ||||
|         super( | ||||
|             _ => new FixedUiElement("Element to import"), | ||||
|             _ => new Combine(["The tags are:", | ||||
|  | @ -43,8 +43,8 @@ class PreviewPanel extends ScrollableFullScreen { | |||
|  * Shows the data to import on a map, asks for the correct layer to be selected | ||||
|  */ | ||||
| export class MapPreview extends Combine implements FlowStep<{ bbox: BBox, layer: LayerConfig, features: any[] }> { | ||||
|     public readonly IsValid: UIEventSource<boolean>; | ||||
|     public readonly Value: UIEventSource<{ bbox: BBox, layer: LayerConfig, features: any[] }> | ||||
|     public readonly IsValid: Store<boolean>; | ||||
|     public readonly Value: Store<{ bbox: BBox, layer: LayerConfig, features: any[] }> | ||||
| 
 | ||||
|     constructor( | ||||
|         state: UserRelatedState, | ||||
|  | @ -85,7 +85,7 @@ export class MapPreview extends Combine implements FlowStep<{ bbox: BBox, layer: | |||
|             return copy | ||||
|         }) | ||||
| 
 | ||||
|         const matching: UIEventSource<{ properties: any, geometry: { coordinates: [number, number] } }[]> = layerPicker.GetValue().map((layer: LayerConfig) => { | ||||
|         const matching: Store<{ properties: any, geometry: { coordinates: [number, number] } }[]> = layerPicker.GetValue().map((layer: LayerConfig) => { | ||||
|             if (layer === undefined) { | ||||
|                 return []; | ||||
|             } | ||||
|  | @ -120,9 +120,9 @@ export class MapPreview extends Combine implements FlowStep<{ bbox: BBox, layer: | |||
|                     appliedFilters: new UIEventSource<Map<string, FilterState>>(undefined) | ||||
|                 }))), | ||||
|             zoomToFeatures: true, | ||||
|             features: new StaticFeatureSource(matching, false), | ||||
|             features: StaticFeatureSource.fromDateless(matching.map(features => features.map(feature => ({feature})))), | ||||
|             leafletMap: map.leafletMap, | ||||
|             popup: (tag, layer) => new PreviewPanel(tag, layer).SetClass("font-lg") | ||||
|             popup: (tag) => new PreviewPanel(tag).SetClass("font-lg") | ||||
|         }) | ||||
|         var bbox = matching.map(feats => BBox.bboxAroundAll(feats.map(f => new BBox([f.geometry.coordinates])))) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue