forked from MapComplete/MapComplete
Merge branches
This commit is contained in:
commit
bae90d50bc
304 changed files with 49983 additions and 31589 deletions
|
|
@ -27,9 +27,9 @@
|
|||
addExtraTags = helperArgs[1].split(";")
|
||||
}
|
||||
|
||||
const path = `${key}s/${maintag.split("=")[0]}/${maintag.split("=")[1]}`
|
||||
const [k, v] = maintag.split("=")
|
||||
|
||||
let items: NSIItem[] = NameSuggestionIndex.getSuggestionsFor(path, feature.properties["_country"], GeoOperations.centerpointCoordinates(feature))
|
||||
let items: NSIItem[] = NameSuggestionIndex.getSuggestionsFor(key, k, v, feature.properties["_country"], GeoOperations.centerpointCoordinates(feature))
|
||||
|
||||
let selectedItem: NSIItem = items.find((item) => item.tags[key] === value.data)
|
||||
|
||||
|
|
@ -113,10 +113,10 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
|
||||
{#if items?.length >= 0}
|
||||
<div>
|
||||
<div class="normal-background my-2 flex w-5/6 justify-between rounded-full pl-2">
|
||||
<!-- TODO translate placeholder -->
|
||||
<input type="text" placeholder="Filter entries" bind:value={filter} class="outline-none" />
|
||||
<SearchIcon aria-hidden="true" class="h-6 w-6 self-end" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
import OpeningHoursInput from "./Helpers/OpeningHoursInput.svelte"
|
||||
import SlopeInput from "./Helpers/SlopeInput.svelte"
|
||||
import type { SpecialVisualizationState } from "../SpecialVisualization"
|
||||
import NameSuggestionIndexInput from "./Helpers/NameSuggestionIndexInput.svelte"
|
||||
|
||||
export let type: ValidatorType
|
||||
export let value: UIEventSource<string | object>
|
||||
|
|
@ -26,6 +27,9 @@
|
|||
export let feature: Feature
|
||||
export let args: (string | number | boolean)[] = undefined
|
||||
export let state: SpecialVisualizationState
|
||||
export let helperArgs: (string | number | boolean)[]
|
||||
export let key: string
|
||||
export let extraTags: UIEventSource<Record<string, string>>
|
||||
|
||||
let properties = { feature, args: args ?? [] }
|
||||
</script>
|
||||
|
|
@ -50,4 +54,6 @@
|
|||
<SlopeInput {value} {feature} {state} />
|
||||
{:else if type === "wikidata"}
|
||||
<ToSvelte construct={() => InputHelpers.constructWikidataHelper(value, properties)} />
|
||||
{:else if type === "nsi"}
|
||||
<NameSuggestionIndexInput {value} {feature} {helperArgs} {key} {extraTags} />
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import TagValidator from "./Validators/TagValidator"
|
|||
import IdValidator from "./Validators/IdValidator"
|
||||
import SlopeValidator from "./Validators/SlopeValidator"
|
||||
import VeloparkValidator from "./Validators/VeloparkValidator"
|
||||
import NameSuggestionIndexValidator from "./Validators/NameSuggestionIndexValidator"
|
||||
import CurrencyValidator from "./Validators/CurrencyValidator"
|
||||
|
||||
export type ValidatorType = (typeof Validators.availableTypes)[number]
|
||||
|
|
@ -61,6 +62,7 @@ export default class Validators {
|
|||
"id",
|
||||
"slope",
|
||||
"velopark",
|
||||
"nsi",
|
||||
"currency"
|
||||
] as const
|
||||
|
||||
|
|
@ -91,6 +93,7 @@ export default class Validators {
|
|||
new IdValidator(),
|
||||
new SlopeValidator(),
|
||||
new VeloparkValidator(),
|
||||
new NameSuggestionIndexValidator(),
|
||||
new CurrencyValidator()
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
import Title from "../../Base/Title"
|
||||
import Combine from "../../Base/Combine"
|
||||
import { Validator } from "../Validator"
|
||||
import Table from "../../Base/Table"
|
||||
|
||||
export default class NameSuggestionIndexValidator extends Validator {
|
||||
constructor() {
|
||||
super(
|
||||
"nsi",
|
||||
new Combine([
|
||||
"Gives a list of possible suggestions for a brand or operator tag.",
|
||||
new Title("Helper arguments"),
|
||||
new Table(
|
||||
["name", "doc"],
|
||||
[
|
||||
[
|
||||
"options",
|
||||
new Combine([
|
||||
"A JSON-object of type `{ main: string, key: string }`. ",
|
||||
new Table(
|
||||
["subarg", "doc"],
|
||||
[
|
||||
[
|
||||
"main",
|
||||
"The main tag to give suggestions for, e.g. `amenity=restaurant`.",
|
||||
],
|
||||
[
|
||||
"addExtraTags",
|
||||
"Extra tags to add to the suggestions, e.g. `nobrand=yes`.",
|
||||
],
|
||||
]
|
||||
),
|
||||
]),
|
||||
],
|
||||
]
|
||||
),
|
||||
])
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue