Skip to content

Commit

Permalink
Avoid aggressively trimming text boxes in configure-beta (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
ac-61 authored Feb 28, 2025
1 parent d1b2b53 commit bc6b1f3
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 9 deletions.
36 changes: 36 additions & 0 deletions configure/src/core/Maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ const getComponent = (
}}
value={value != null ? value : getIn(directConf, com.field, "")}
onChange={(e) => {
updateConfiguration(forceField || com.field, e.target.value, layer);
}}
onBlur={(e) => {
let v = e.target.value;
// remove surrounding whitespace, " hi " -> "hi"
if (typeof v === "string") v = v.trim();
Expand All @@ -280,6 +283,39 @@ const getComponent = (
)}
</div>
);
case "textnotrim":
inner = (
<TextField
className={c.text}
label={com.name}
variant="filled"
size="small"
inputProps={{
autoComplete: "off",
}}
value={value != null ? value : getIn(directConf, com.field, "")}
onChange={(e) => {
updateConfiguration(forceField || com.field, e.target.value, layer);
}}
/>
);
return (
<div>
{inlineHelp ? (
<>
{inner}
<div
className={c.subtitle2}
dangerouslySetInnerHTML={{ __html: com.description || "" }}
></div>
</>
) : (
<Tooltip title={com.description || ""} placement="top" arrow>
{inner}
</Tooltip>
)}
</div>
);
case "button":
inner = (
<Button
Expand Down
2 changes: 1 addition & 1 deletion configure/src/metaconfigs/layer-data-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"field": "name",
"name": "Layer Name",
"description": "",
"type": "text",
"type": "textnotrim",
"width": 8
},
{
Expand Down
2 changes: 1 addition & 1 deletion configure/src/metaconfigs/layer-header-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"field": "name",
"name": "Layer Name",
"description": "",
"type": "text",
"type": "textnotrim",
"width": 8
}
]
Expand Down
2 changes: 1 addition & 1 deletion configure/src/metaconfigs/layer-model-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"field": "name",
"name": "Layer Name",
"description": "A display name for the layer.",
"type": "text",
"type": "textnotrim",
"width": 6
},
{
Expand Down
2 changes: 1 addition & 1 deletion configure/src/metaconfigs/layer-query-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"field": "name",
"name": "Layer Name",
"description": "A display name for the layer.",
"type": "text",
"type": "textnotrim",
"width": 6
},
{
Expand Down
4 changes: 2 additions & 2 deletions configure/src/metaconfigs/layer-tile-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"field": "name",
"name": "Layer Name",
"description": "",
"type": "text",
"type": "textnotrim",
"width": 4
},
{
Expand Down Expand Up @@ -201,7 +201,7 @@
"field": "cogUnits",
"name": "Units",
"description": "Units string by which to suffix values. For instance if the units are meters, use 'm' so that values are displayed as '100m'.",
"type": "text",
"type": "textnotrim",
"width": 2
},
{
Expand Down
2 changes: 1 addition & 1 deletion configure/src/metaconfigs/layer-vector-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"field": "name",
"name": "Layer Name",
"description": "A display name for the layer.",
"type": "text",
"type": "textnotrim",
"width": 6
},
{
Expand Down
2 changes: 1 addition & 1 deletion configure/src/metaconfigs/layer-vectortile-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"field": "name",
"name": "Layer Name",
"description": "A display name for the layer.",
"type": "text",
"type": "textnotrim",
"width": 6
},
{
Expand Down
2 changes: 1 addition & 1 deletion configure/src/metaconfigs/layer-velocity-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"field": "name",
"name": "Layer Name",
"description": "A display name for the layer.",
"type": "text",
"type": "textnotrim",
"width": 6
},
{
Expand Down

0 comments on commit bc6b1f3

Please sign in to comment.