forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
c9ce29f206
commit
40e894df8b
294 changed files with 14209 additions and 4192 deletions
|
|
@ -20,7 +20,7 @@
|
|||
let mla = new MapLibreAdaptor(map, mapProperties)
|
||||
mla.allowMoving.setData(false)
|
||||
mla.allowZooming.setData(false)
|
||||
state?.mapProperties?.rasterLayer?.addCallbackAndRunD(l => mla.rasterLayer.set(l))
|
||||
state?.mapProperties?.rasterLayer?.addCallbackAndRunD((l) => mla.rasterLayer.set(l))
|
||||
|
||||
let directionElem: HTMLElement | undefined
|
||||
$: value.addCallbackAndRunD((degrees) => {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
export let wd: number
|
||||
export let h: number
|
||||
export let type: "full" | "half"
|
||||
let dispatch = createEventDispatcher<{ "start", "end", "move","clear" }>()
|
||||
let dispatch = createEventDispatcher<{ start; end; move; clear }>()
|
||||
let element: HTMLElement
|
||||
|
||||
function send(signal: "start" | "end" | "move", ev: Event) {
|
||||
|
|
@ -39,32 +39,30 @@
|
|||
element.onmouseenter = (ev) => send("move", ev)
|
||||
element.onmouseup = (ev) => send("end", ev)
|
||||
|
||||
element.addEventListener("touchstart", ev => dispatch("start", ev))
|
||||
element.addEventListener("touchend", ev => {
|
||||
|
||||
element.addEventListener("touchstart", (ev) => dispatch("start", ev))
|
||||
element.addEventListener("touchend", (ev) => {
|
||||
const el = elementUnderTouch(ev)
|
||||
if (el?.onmouseup) {
|
||||
el?.onmouseup(<any>ev)
|
||||
}else{
|
||||
} else {
|
||||
// We dragged outside of the table
|
||||
dispatch("clear")
|
||||
}
|
||||
|
||||
})
|
||||
element.addEventListener("touchmove", ev => {
|
||||
element.addEventListener("touchmove", (ev) => {
|
||||
const underTouch = elementUnderTouch(ev)
|
||||
if(typeof underTouch?.onmouseenter !== "function"){
|
||||
return
|
||||
}
|
||||
if (typeof underTouch?.onmouseenter !== "function") {
|
||||
return
|
||||
}
|
||||
|
||||
underTouch.onmouseenter(<any>ev)
|
||||
underTouch.onmouseenter(<any>ev)
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<td bind:this={element} id={"oh-"+type+"-"+h+"-"+wd}
|
||||
class:border-black={(h + 1) % 6 === 0}
|
||||
class={`oh-timecell oh-timecell-${type} oh-timecell-${wd} `}
|
||||
<td
|
||||
bind:this={element}
|
||||
id={"oh-" + type + "-" + h + "-" + wd}
|
||||
class:border-black={(h + 1) % 6 === 0}
|
||||
class={`oh-timecell oh-timecell-${type} oh-timecell-${wd} `}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<script lang="ts">
|
||||
|
||||
import { UIEventSource } from "../../../../Logic/UIEventSource"
|
||||
import type { OpeningHour } from "../../../OpeningHours/OpeningHours"
|
||||
import { OH as OpeningHours } from "../../../OpeningHours/OpeningHours"
|
||||
|
|
@ -27,10 +26,9 @@
|
|||
let element: HTMLTableElement
|
||||
|
||||
function range(n: number) {
|
||||
return Utils.TimesT(n, n => n)
|
||||
return Utils.TimesT(n, (n) => n)
|
||||
}
|
||||
|
||||
|
||||
function clearSelection() {
|
||||
const allCells = Array.from(document.getElementsByClassName("oh-timecell"))
|
||||
for (const timecell of allCells) {
|
||||
|
|
@ -38,27 +36,33 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function setSelectionNormalized(weekdayStart: number, weekdayEnd: number, hourStart: number, hourEnd: number) {
|
||||
function setSelectionNormalized(
|
||||
weekdayStart: number,
|
||||
weekdayEnd: number,
|
||||
hourStart: number,
|
||||
hourEnd: number
|
||||
) {
|
||||
for (let wd = weekdayStart; wd <= weekdayEnd; wd++) {
|
||||
for (let h = (hourStart); h < (hourEnd); h++) {
|
||||
for (let h = hourStart; h < hourEnd; h++) {
|
||||
h = Math.floor(h)
|
||||
if (h >= hourStart && h < hourEnd) {
|
||||
const elFull = document.getElementById("oh-full-" + h + "-" + wd)
|
||||
elFull?.classList?.add("oh-timecell-selected")
|
||||
}
|
||||
if (h + 0.5 < hourEnd) {
|
||||
|
||||
const elHalf = document.getElementById("oh-half-" + h + "-" + wd)
|
||||
elHalf?.classList?.add("oh-timecell-selected")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setSelection(weekdayStart: number, weekdayEnd: number, hourStart: number, hourEnd: number) {
|
||||
function setSelection(
|
||||
weekdayStart: number,
|
||||
weekdayEnd: number,
|
||||
hourStart: number,
|
||||
hourEnd: number
|
||||
) {
|
||||
let hourA = hourStart
|
||||
let hourB = hourEnd
|
||||
if (hourA > hourB) {
|
||||
|
|
@ -69,8 +73,12 @@
|
|||
hourA -= 0.5
|
||||
hourB += 0.5
|
||||
}
|
||||
setSelectionNormalized(Math.min(weekdayStart, weekdayEnd), Math.max(weekdayStart, weekdayEnd),
|
||||
hourA, hourB)
|
||||
setSelectionNormalized(
|
||||
Math.min(weekdayStart, weekdayEnd),
|
||||
Math.max(weekdayStart, weekdayEnd),
|
||||
hourA,
|
||||
hourB
|
||||
)
|
||||
}
|
||||
|
||||
let selectionStart: [number, number] = undefined
|
||||
|
|
@ -100,8 +108,11 @@
|
|||
let startMinutes = Math.round((start * 60) % 60)
|
||||
let endMinutes = Math.round((end * 60) % 60)
|
||||
let newOhs = [...value.data]
|
||||
for (let wd = Math.min(selectionStart[0], weekday); wd <= Math.max(selectionStart[0], weekday); wd++) {
|
||||
|
||||
for (
|
||||
let wd = Math.min(selectionStart[0], weekday);
|
||||
wd <= Math.max(selectionStart[0], weekday);
|
||||
wd++
|
||||
) {
|
||||
const oh: OpeningHour = {
|
||||
startHour: Math.floor(start),
|
||||
endHour: Math.floor(end),
|
||||
|
|
@ -116,7 +127,6 @@
|
|||
clearSelection()
|
||||
}
|
||||
|
||||
|
||||
let lasttouched: [number, number] = undefined
|
||||
|
||||
function moved(weekday: number, hour: number) {
|
||||
|
|
@ -125,11 +135,10 @@
|
|||
clearSelection()
|
||||
setSelection(selectionStart[0], weekday, selectionStart[1], hour + 0.5)
|
||||
}
|
||||
const allRows = Array.from(element.getElementsByTagName("tr"))
|
||||
const allRows = Array.from(element.getElementsByTagName("tr"))
|
||||
for (const r of allRows) {
|
||||
r.classList.remove("hover")
|
||||
r.classList.remove("hovernext")
|
||||
|
||||
}
|
||||
const selectedRow = allRows[hour * 2 + 2]
|
||||
selectedRow?.classList?.add("hover")
|
||||
|
|
@ -158,26 +167,33 @@
|
|||
* @param oh
|
||||
*/
|
||||
function rangeStyle(oh: OpeningHour, totalHeight: number): string {
|
||||
const top = (oh.startHour + oh.startMinutes / 60) * totalHeight / 24
|
||||
const height = (oh.endHour - oh.startHour + (oh.endMinutes - oh.startMinutes) / 60) * totalHeight / 24
|
||||
const top = ((oh.startHour + oh.startMinutes / 60) * totalHeight) / 24
|
||||
const height =
|
||||
((oh.endHour - oh.startHour + (oh.endMinutes - oh.startMinutes) / 60) * totalHeight) / 24
|
||||
return `top: ${top}px; height: ${height}px; z-index: 20`
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<table
|
||||
bind:this={element}
|
||||
class="oh-table no-weblate w-full" cellspacing="0" cellpadding="0"
|
||||
class:hasselection={selectionStart !== undefined} class:hasnoselection={selectionStart === undefined}
|
||||
on:mouseleave={mouseLeft}>
|
||||
class="oh-table no-weblate w-full"
|
||||
cellspacing="0"
|
||||
cellpadding="0"
|
||||
class:hasselection={selectionStart !== undefined}
|
||||
class:hasnoselection={selectionStart === undefined}
|
||||
on:mouseleave={mouseLeft}
|
||||
>
|
||||
<tr>
|
||||
<!-- Header row -->
|
||||
<th style="width: 9%">
|
||||
<!-- Top-left cell -->
|
||||
<slot name="top-left">
|
||||
<button class="absolute top-0 left-0 p-1 rounded-full" on:click={() => value.set([])} style="z-index: 10">
|
||||
<TrashIcon class="w-5 h-5" />
|
||||
<button
|
||||
class="absolute top-0 left-0 rounded-full p-1"
|
||||
on:click={() => value.set([])}
|
||||
style="z-index: 10"
|
||||
>
|
||||
<TrashIcon class="h-5 w-5" />
|
||||
</button>
|
||||
</slot>
|
||||
</th>
|
||||
|
|
@ -188,101 +204,116 @@
|
|||
{/each}
|
||||
</tr>
|
||||
|
||||
<tr class="h-0 nobold">
|
||||
<tr class="nobold h-0">
|
||||
<!-- Virtual row to add the ranges to-->
|
||||
<td style="width: 9%" />
|
||||
{#each range(7) as wd}
|
||||
<td style="width: 13%; position: relative;">
|
||||
|
||||
<div class="h-0 pointer-events-none" style="z-index: 10">
|
||||
{#each $value.filter(oh => oh.weekday === wd).map(oh => OpeningHours.rangeAs24Hr(oh)) as range }
|
||||
<div class="absolute pointer-events-none px-1 md:px-2 w-full "
|
||||
style={rangeStyle(range, totalHeight)}
|
||||
<div class="pointer-events-none h-0" style="z-index: 10">
|
||||
{#each $value
|
||||
.filter((oh) => oh.weekday === wd)
|
||||
.map((oh) => OpeningHours.rangeAs24Hr(oh)) as range}
|
||||
<div
|
||||
class="pointer-events-none absolute w-full px-1 md:px-2"
|
||||
style={rangeStyle(range, totalHeight)}
|
||||
>
|
||||
<div class="rounded-xl border-interactive h-full low-interaction flex flex-col justify-between">
|
||||
<div
|
||||
class="border-interactive low-interaction flex h-full flex-col justify-between rounded-xl"
|
||||
>
|
||||
<div class:hidden={range.endHour - range.startHour < 3}>
|
||||
{OpeningHours.hhmm(range.startHour, range.startMinutes)}
|
||||
</div>
|
||||
<button class="w-fit rounded-full p-1 self-center pointer-events-auto"
|
||||
on:click={() => {
|
||||
const cleaned = value.data.filter(v => !OpeningHours.isSame(v, range))
|
||||
console.log("Cleaned", cleaned, OpeningHours.ToString(value.data))
|
||||
value.set(cleaned)
|
||||
}}>
|
||||
<TrashIcon class="w-6 h-6" />
|
||||
<button
|
||||
class="pointer-events-auto w-fit self-center rounded-full p-1"
|
||||
on:click={() => {
|
||||
const cleaned = value.data.filter((v) => !OpeningHours.isSame(v, range))
|
||||
console.log("Cleaned", cleaned, OpeningHours.ToString(value.data))
|
||||
value.set(cleaned)
|
||||
}}
|
||||
>
|
||||
<TrashIcon class="h-6 w-6" />
|
||||
</button>
|
||||
<div class:hidden={range.endHour - range.startHour < 3}>
|
||||
{OpeningHours.hhmm(range.endHour, range.endMinutes)}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
{/each}
|
||||
|
||||
</tr>
|
||||
|
||||
{#each range(24) as h}
|
||||
<tr style="height: 0.75rem; width: 9%"> <!-- even row, for the hour -->
|
||||
<td rowspan={ h > 0 ? 2: 1 }
|
||||
class="relative text-sm sm:text-base oh-left-col oh-timecell-full border-box interactive "
|
||||
style={ h > 0 ? "top: -0.75rem" : "height:0; top: -0.75rem"}>
|
||||
<tr style="height: 0.75rem; width: 9%">
|
||||
<!-- even row, for the hour -->
|
||||
<td
|
||||
rowspan={h > 0 ? 2 : 1}
|
||||
class="oh-left-col oh-timecell-full border-box interactive relative text-sm sm:text-base"
|
||||
style={h > 0 ? "top: -0.75rem" : "height:0; top: -0.75rem"}
|
||||
>
|
||||
{#if h > 0}
|
||||
<span class="hour-header w-full">
|
||||
{h}:00
|
||||
{h}:00
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
{#each range(7) as wd}
|
||||
<OHCell type="full" {h} {wd} on:start={() => startSelection(wd, h)} on:end={() => endSelection(wd, h)}
|
||||
on:move={() => moved(wd, h)} on:clear={() => clearSelection()} />
|
||||
<OHCell
|
||||
type="full"
|
||||
{h}
|
||||
{wd}
|
||||
on:start={() => startSelection(wd, h)}
|
||||
on:end={() => endSelection(wd, h)}
|
||||
on:move={() => moved(wd, h)}
|
||||
on:clear={() => clearSelection()}
|
||||
/>
|
||||
{/each}
|
||||
</tr>
|
||||
|
||||
<tr style="height: calc( 0.75rem - 1px) "> <!-- odd row, for the half hour -->
|
||||
<tr style="height: calc( 0.75rem - 1px) ">
|
||||
<!-- odd row, for the half hour -->
|
||||
{#if h === 0}
|
||||
<td/> <!-- extra cell to compensate for irregular header-->
|
||||
<td />
|
||||
<!-- extra cell to compensate for irregular header-->
|
||||
{/if}
|
||||
{#each range(7) as wd}
|
||||
<OHCell type="half" {h} {wd} on:start={() => startSelection(wd, h + 0.5)}
|
||||
on:end={() => endSelection(wd, h + 0.5)}
|
||||
on:move={() => moved(wd, h + 0.5)} on:clear={() => clearSelection()} />
|
||||
<OHCell
|
||||
type="half"
|
||||
{h}
|
||||
{wd}
|
||||
on:start={() => startSelection(wd, h + 0.5)}
|
||||
on:end={() => endSelection(wd, h + 0.5)}
|
||||
on:move={() => moved(wd, h + 0.5)}
|
||||
on:clear={() => clearSelection()}
|
||||
/>
|
||||
{/each}
|
||||
</tr>
|
||||
|
||||
{/each}
|
||||
|
||||
</table>
|
||||
|
||||
<style>
|
||||
th {
|
||||
top: 0;
|
||||
position: sticky;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
th {
|
||||
top: 0;
|
||||
position: sticky;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
|
||||
.hasselection tr:hover .hour-header, .hasselection tr.hover .hour-header {
|
||||
border-bottom: 2px solid black;
|
||||
}
|
||||
|
||||
|
||||
.hasselection tr:hover + tr {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hasselection tr.hovernext {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hasnoselection tr:hover, .hasnoselection tr.hover {
|
||||
font-weight: bold;
|
||||
}
|
||||
.hasselection tr:hover .hour-header,
|
||||
.hasselection tr.hover .hour-header {
|
||||
border-bottom: 2px solid black;
|
||||
}
|
||||
|
||||
.hasselection tr:hover + tr {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hasselection tr.hovernext {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hasnoselection tr:hover,
|
||||
.hasnoselection tr.hover {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
let postfix = ""
|
||||
if (args) {
|
||||
try {
|
||||
|
||||
const data = JSON.stringify(args)
|
||||
if (data["prefix"]) {
|
||||
prefix = data["prefix"]
|
||||
|
|
@ -31,11 +30,15 @@
|
|||
const state = new OpeningHoursState(value, prefix, postfix)
|
||||
let expanded = new UIEventSource(false)
|
||||
</script>
|
||||
|
||||
<Popup bodyPadding="p-0" shown={expanded}>
|
||||
<OHTable value={state.normalOhs} />
|
||||
<button on:click={() => expanded.set(false)} class="absolute left-0 bottom-0 primary pointer-events-auto h-8 w-10 rounded-full">
|
||||
<Check class="shrink-0 w-6 h-6 m-0 p-0" color="white"/>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => expanded.set(false)}
|
||||
class="primary pointer-events-auto absolute left-0 bottom-0 h-8 w-10 rounded-full"
|
||||
>
|
||||
<Check class="m-0 h-6 w-6 shrink-0 p-0" color="white" />
|
||||
</button>
|
||||
</Popup>
|
||||
<button on:click={() => expanded.set(true)}>Pick opening hours</button>
|
||||
<PublicHolidaySelector value={state.phSelectorValue} />
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export default class Validators {
|
|||
"velopark",
|
||||
"nsi",
|
||||
"currency",
|
||||
"regex"
|
||||
"regex",
|
||||
] as const
|
||||
|
||||
public static readonly AllValidators: ReadonlyArray<Validator> = [
|
||||
|
|
@ -94,7 +94,7 @@ export default class Validators {
|
|||
new VeloparkValidator(),
|
||||
new NameSuggestionIndexValidator(),
|
||||
new CurrencyValidator(),
|
||||
new RegexValidator()
|
||||
new RegexValidator(),
|
||||
]
|
||||
|
||||
private static _byType = Validators._byTypeConstructor()
|
||||
|
|
|
|||
|
|
@ -7,23 +7,24 @@ export default class OpeningHoursValidator extends Validator {
|
|||
"opening_hours",
|
||||
[
|
||||
"Has extra elements to easily input when a POI is opened.",
|
||||
("### Helper arguments"),
|
||||
"### Helper arguments",
|
||||
"Only one helper argument named `options` can be provided. It is a JSON-object of type `{ prefix: string, postfix: string }`:",
|
||||
MarkdownUtils.table(
|
||||
["subarg", "doc"],
|
||||
[
|
||||
[
|
||||
"prefix",
|
||||
"Piece of text that will always be added to the front of the generated opening hours. If the OSM-data does not start with this, it will fail to parse."
|
||||
"Piece of text that will always be added to the front of the generated opening hours. If the OSM-data does not start with this, it will fail to parse.",
|
||||
],
|
||||
[
|
||||
"postfix",
|
||||
"Piece of text that will always be added to the end of the generated opening hours"
|
||||
]
|
||||
]),
|
||||
("### Example usage"),
|
||||
"Piece of text that will always be added to the end of the generated opening hours",
|
||||
],
|
||||
]
|
||||
),
|
||||
"### Example usage",
|
||||
"To add a conditional (based on time) access restriction:\n\n```\n" +
|
||||
`
|
||||
`
|
||||
"freeform": {
|
||||
"key": "access:conditional",
|
||||
"type": "opening_hours",
|
||||
|
|
@ -34,7 +35,7 @@ export default class OpeningHoursValidator extends Validator {
|
|||
}
|
||||
]
|
||||
}` +
|
||||
"\n```\n\n*Don't forget to pass the prefix and postfix in the rendering as well*: `{opening_hours_table(opening_hours,yes @ &LPARENS, &RPARENS )`"
|
||||
"\n```\n\n*Don't forget to pass the prefix and postfix in the rendering as well*: `{opening_hours_table(opening_hours,yes @ &LPARENS, &RPARENS )`",
|
||||
].join("\n")
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,15 +48,12 @@ export default class PhoneValidator extends Validator {
|
|||
}
|
||||
let countryCode: CountryCode = undefined
|
||||
if (country) {
|
||||
countryCode = <CountryCode> country()?.toUpperCase()
|
||||
countryCode = <CountryCode>country()?.toUpperCase()
|
||||
}
|
||||
if (this.isShortCode(str, countryCode)) {
|
||||
return str
|
||||
}
|
||||
return parsePhoneNumberFromString(
|
||||
str,
|
||||
countryCode
|
||||
)?.formatInternational()
|
||||
return parsePhoneNumberFromString(str, countryCode)?.formatInternational()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@ import { s } from "vitest/dist/env-afee91f0"
|
|||
import { Translation } from "../../i18n/Translation"
|
||||
import Translations from "../../i18n/Translations"
|
||||
|
||||
export default class RegexValidator extends StringValidator{
|
||||
export default class RegexValidator extends StringValidator {
|
||||
constructor() {
|
||||
super("regex", "Validates a regex")
|
||||
}
|
||||
|
||||
getFeedback(s: string): Translation | undefined {
|
||||
try{
|
||||
try {
|
||||
new RegExp(s)
|
||||
}catch (e) {
|
||||
return Translations.T("Not a valid Regex: "+e)
|
||||
} catch (e) {
|
||||
return Translations.T("Not a valid Regex: " + e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ export default class WikidataValidator extends Validator {
|
|||
[
|
||||
[
|
||||
"key",
|
||||
"the value of this tag will initialize search (default: name). This can be a ';'-separated list in which case every key will be inspected. The non-null value will be used as search"
|
||||
"the value of this tag will initialize search (default: name). This can be a ';'-separated list in which case every key will be inspected. The non-null value will be used as search",
|
||||
],
|
||||
[
|
||||
"options",
|
||||
"A JSON-object of type `{ removePrefixes: Record<string, string[]>, removePostfixes: Record<string, string[]>, ... }`. See the more detailed explanation below"
|
||||
]
|
||||
"A JSON-object of type `{ removePrefixes: Record<string, string[]>, removePostfixes: Record<string, string[]>, ... }`. See the more detailed explanation below",
|
||||
],
|
||||
]
|
||||
),
|
||||
"#### Suboptions",
|
||||
|
|
@ -31,28 +31,26 @@ export default class WikidataValidator extends Validator {
|
|||
[
|
||||
[
|
||||
"removePrefixes",
|
||||
"remove these snippets of text from the start of the passed string to search. This is either a list OR a hash of languages to a list. The individual strings are interpreted as case ignoring regexes"
|
||||
"remove these snippets of text from the start of the passed string to search. This is either a list OR a hash of languages to a list. The individual strings are interpreted as case ignoring regexes",
|
||||
],
|
||||
[
|
||||
"removePostfixes",
|
||||
"remove these snippets of text from the end of the passed string to search. This is either a list OR a hash of languages to a list. The individual strings are interpreted as case ignoring regexes."
|
||||
"remove these snippets of text from the end of the passed string to search. This is either a list OR a hash of languages to a list. The individual strings are interpreted as case ignoring regexes.",
|
||||
],
|
||||
[
|
||||
"instanceOf",
|
||||
"A list of Q-identifier which indicates that the search results _must_ be an entity of this type, e.g. [`Q5`](https://www.wikidata.org/wiki/Q5) for humans"
|
||||
"A list of Q-identifier which indicates that the search results _must_ be an entity of this type, e.g. [`Q5`](https://www.wikidata.org/wiki/Q5) for humans",
|
||||
],
|
||||
[
|
||||
"notInstanceof",
|
||||
"A list of Q-identifiers which indicates that the search results _must not_ be an entity of this type, e.g. [`Q79007`](https://www.wikidata.org/wiki/Q79007) to filter away all streets from the search results"
|
||||
"A list of Q-identifiers which indicates that the search results _must not_ be an entity of this type, e.g. [`Q79007`](https://www.wikidata.org/wiki/Q79007) to filter away all streets from the search results",
|
||||
],
|
||||
[
|
||||
"multiple",
|
||||
"If 'yes' or 'true', will allow to select multiple values at once"
|
||||
]
|
||||
["multiple", "If 'yes' or 'true', will allow to select multiple values at once"],
|
||||
]
|
||||
)
|
||||
),
|
||||
].join("\n\n")
|
||||
private static readonly docsExampleUsage: string = "### Example usage\n\n" +
|
||||
private static readonly docsExampleUsage: string =
|
||||
"### Example usage\n\n" +
|
||||
`The following is the 'freeform'-part of a layer config which will trigger a search for the wikidata item corresponding with the name of the selected feature. It will also remove '-street', '-square', ... if found at the end of the name
|
||||
|
||||
\`\`\`json
|
||||
|
|
@ -96,9 +94,13 @@ Another example is to search for species and trees:
|
|||
\`\`\`
|
||||
`
|
||||
|
||||
|
||||
constructor() {
|
||||
super("wikidata", "A wikidata identifier, e.g. Q42.\n\n" + WikidataValidator.docs + WikidataValidator.docsExampleUsage)
|
||||
super(
|
||||
"wikidata",
|
||||
"A wikidata identifier, e.g. Q42.\n\n" +
|
||||
WikidataValidator.docs +
|
||||
WikidataValidator.docsExampleUsage
|
||||
)
|
||||
}
|
||||
|
||||
public isValid(str): boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue