forked from MapComplete/MapComplete
Add placeholder options for freeform keys
This commit is contained in:
parent
73984ad462
commit
400756cdea
3 changed files with 9 additions and 1 deletions
|
@ -56,6 +56,11 @@ export interface TagRenderingConfigJson {
|
|||
* See Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values
|
||||
*/
|
||||
type?: string,
|
||||
/**
|
||||
* A (translated) text that is shown (as gray text) within the textfield
|
||||
*/
|
||||
placeholder: string | any
|
||||
|
||||
/**
|
||||
* Extra parameters to initialize the input helper arguments.
|
||||
* For semantics, see the 'SpecialInputElements.md'
|
||||
|
|
|
@ -30,6 +30,7 @@ export default class TagRenderingConfig {
|
|||
readonly freeform?: {
|
||||
readonly key: string,
|
||||
readonly type: string,
|
||||
readonly placeholder: Translation,
|
||||
readonly addExtraTags: TagsFilter[];
|
||||
readonly inline: boolean,
|
||||
readonly default?: string,
|
||||
|
@ -93,6 +94,7 @@ export default class TagRenderingConfig {
|
|||
this.freeform = {
|
||||
key: json.freeform.key,
|
||||
type: json.freeform.type ?? "string",
|
||||
placeholder: Translations.T(json.freeform.placeholder ?? (json.freeform.key + "(" + (json.freeform.type ?? "string") + ")")),
|
||||
addExtraTags: json.freeform.addExtraTags?.map((tg, i) =>
|
||||
TagUtils.Tag(tg, `${context}.extratag[${i}]`)) ?? [],
|
||||
inline: json.freeform.inline ?? false,
|
||||
|
|
|
@ -425,7 +425,8 @@ export default class TagRenderingQuestion extends Combine {
|
|||
mapBackgroundLayer: state.backgroundLayer,
|
||||
unit: applicableUnit,
|
||||
args: configuration.freeform.helperArgs,
|
||||
feature: feature
|
||||
feature: feature,
|
||||
placeholder: configuration.freeform.placeholder
|
||||
});
|
||||
|
||||
input.GetValue().setData(tagsData[freeform.key] ?? freeform.default);
|
||||
|
|
Loading…
Add table
Reference in a new issue